So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based off the fact that I added a std::string to a class and assigning it a value from another std::string:
std::string hello = "Hello, world.\n";
/* exampleString = "Hello, world.\n" would work fine. */
exampleStr...
Does anyone know how I can, in platform-independant C++ code prevent an object from being created on the heap? That is, for a class "Foo", I want to prevent users from doing this:
Foo *ptr = new Foo;
and only allow them to do this:
Foo myfooObject;
Does anyone have any ideas?
Cheers,
...
I am writing a client-side Swing application (graphical font designer) on Java 5. Recently, I am running into "java.lang.OutOfMemoryError: Java heap space" error because I am not being conservative on memory usage. The user can open unlimited number of files, and the program keeps the opened objects in the memory. After a quick research ...
I've been running into a peculiar issue with certain Java applications in the HP-UX environment.
The heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA region. Grows quite rapidly over a 24-48hour period and the...
Programming language books usually explain that value types are created on the stack, and reference types created on the heap, without really explaining what these two things are. With my only programming experience being in high level languages, I haven't read a clear explanation of this. I mean I understand what a stack is, but where...
Is the a VS2005 C++ compiler flag like the Xmx???M java flag so I can limit the heap size of my application running on Windows.
I need to limit the heap size so I can fill the memory to find out the current free memory. (The code also runs on an embedded system where this is the best method to get the memory usage)
...
I am looking for a .Net (preferably C#) implementation of a priority queue or heap.
Unless I am looking in the wrong place, there isn't one in the framework. Is anyone aware of a good one, or should I roll my own?
...
A heap is a list where the following applies:
l[i] <= l[2*i] && l[i] <= [2*i+1]
for 0 <= i < len(list)
I'm looking for in-place sorting.
...
Killing the processs while obtaining this information would be fine.
...
This is clearly not appears like it wouldn't be a best practice, but can someone explain why or how this works. Or recommend a good book to learn more.
//The constructor
public Page_Index() {
//create a local value
string currentValue = "This is the FIRST value";
//use the local variable in a delegate that fires later
...
I'm currently working on a project for medical image processing, that needs a huge amount of memory. Is there anything I can do to avoid heap fragmentation and to speed up access of image data that has already been loaded into memory?
The application has been written in C++ and runs on Windows XP.
EDIT: The application does some prepro...
I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError
Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it.
Any ideas?
...
I'm working on designing the kernel (which I'm going to actually call the "core" just to be different, but its basically the same) for an OS I'm working on. The specifics of the OS itself are irrelevant if I can't get multi-tasking, memory management, and other basic things up and running, so I need to work on that first. I've some quest...
I'm looking for ideas for a heap-manager to handle a very specific situation: Lots and lots of very small allocations, ranging from 12 to 64 bytes each. Anything bigger, I will pass on to the regular heap-manager, so only tiny blocks need be catered for. Only 4-byte alignment is needed.
My main concerns are
Overhead. The regular libc ...
I was really looking at the differences between pass by value and how Java allocates objects and what java does to put objects on the stack.
Is there anyway to access objects allocated on the heap? What mechanisms does java enforce to guarantee that the right method can access the right data off the heap?
It seems like if you were cra...
Coming from a java background, one of the things I am used to is telling the JVM what the maximum heap size should be. If the running program tries to swallow more than is allowed, and the garbage collector cannot free any more resources, then OutOfMemoryError is thrown and it all goes bang. So setting the maximum heap size is importan...
Please enlighten me.
public class SomeObject{
private String strSomeProperty;
public SomeObject(String strSomeProperty){
this.strSomeProperty = strSomeProperty;
}
public void setSomeProperty(String strSomeProperty){
this.strSomeProperty = strSomeProperty;
}
public String getSomeProperty(){
retur...
I went looking for this the other day, and thought it should probably be added to StackOverflow's reservoir of questions.
How would I go about dynamically allocating a multi-dimensional array?
...
Is there any way to increase the heap size for j2me on a device? I'm developing an application for a Nokia N95, but am bumping into memory issues when I try to do image processing of larger images. The phone has plenty of heap space available, but seems to restrict the amount allowed to be used by j2me to 1MB.
...
Having analyzed a light-load web application running in tomcat, using JMX Console, it turns out the "PS Old Gen" is growing slowly but constant. It starts with 200MB and grows around 80MB/Hour.
CPU is not an issue, it runs at 0-1% on average, but somewhere it leaks memory, so it will become unstable some days after deployment.
How do i...