heap

boost::shared_ptr and multithreaded access

Hi! I'm trying to implement a multithreaded framework, in which output objects are created at the end of every frame that my networking thread runs, so that another thread can, at the beginning of its frame, obtain the most recent "completed output" pointer and know that it has safe and complete read-only access to any data stored withi...

Dealing with an object corrupting the heap

Hi there, In my application I am creating an object pretty much like this : connect() { mVHTGlove = new vhtGlove(params); } and once I am about to close application I call this one : disconnect() { if (mVHTGlove) delete mVHTGlove; } This call always triggers a breakpoint with the following message : Windows has trigg...

Prototype for function that allocates memory on the heap (C/C++)

Hi all, I'm fairly new to C++ so this is probably somewhat of a beginner question. It regards the "proper" style for doing something I suspect to be rather common. I'm writing a function that, in performing its duties, allocates memory on the heap for use by the caller. I'm curious about what a good prototype for this function should...

jvm - what is the optimal freeheap to totalheap ratio?

what is the optimal freeheap to totalheap ratio? At what values of this ratio should I consider increasing the heap size/ decreasing the heap size? ...

Can I programmatically view the managed heap contents from a .NET application?

Is it possible to access the managed heap in a .NET application and e.g. enumerate the objects that are currently allocated there? I know there are various tools out there that allow you to do that, but I would rather do this myself from code so that I can use it in automated tests, like for checking if everything is disposed and cleane...

Heap corruption

Why is it a problem if we have a huge piece of code between new and delete of a char array. Example void this_is_bad() /* You wouldn't believe how often this kind of code can be found */ { char *p = new char[5]; /* spend some cycles in the memory manager */ /* do some stuff with p */ delete[] p; /* spend some more cycles,...

Where methods live? Stack or in Heap?

Hi, I know that local variables and paramters of methods live in stack, but I not able to figure out where does actually methods live in case of Java? If I declare any Thread object like: Thread t=new Thread(); t.start(); So it means I've created a separate calling of methods apart from main method. What does it mean? Does it mean c...

How do the stack, heap and frame conceptually map to c# constructs?

How are the they all related as well? (Code samples would be appreciated!!!) Edit: Given the fact that I didn't know these terms were this overloaded, let me clarify: By stack, I don't mean the data structure stack. By frame, I mean stack frame. And heap, well, I think I mighhhht be okay on that one... ...

java gui changing picture causes heapspace error

I have a java programme than when a button is clicked it updates the image on screen to the according image. this will work for the first 15 or so clicks then it causes a java heapspace error. I think it is because of the way I am updating the jpanel that contains the bufferedimage but not sure what the reason is. My code to get make the...

Increasing Java Heap size on Virtual server?

Peeps, I'm hosting our dev env on a virtual server over at Mediatemple - the $50 bucks a month kind. Our application does some fairly memory intensive processing and on the last run, ran into the OutofMemError. Apparently increasing the JVM size using the usual methods of setting JAVA_OPT or CATALINA_OPT in the setenv.sh file doesnt...

Why is the heap (as in where we put objects) called that?

Possible Duplicate: What is the origin of the term heap for the free store? Why is the heap called the heap? I mean the bit of memory which we dynamically allocate bits of. ...

Way to increase memory allocated on free store

Is it possible to incrementally increase the amount of allocated memory on a free store that a pointer points to? For example, I know that this is possible. char* p = new char; // allocates one char to free store char* p = new char[10]; // allocates 10 chars to free store but what if I wanted to do something like increase the amount o...

Disabling Local JMX Connections on JVM

Hi, We are writing a java program which keeps a password in memory. Unfortunately, the user can easily use jconsole or jmap to create a heap dump file and open it to find the password. I think jconsole connects jvm using local sockets. I wanna know, is there any way to disable jmx even for local users? Is there any way to totally disable...

Copying C-Style String to Free Store Using Only Dereference

As said in the title, the goal is to copy a c-style string into memory without using any standard library functions or subscripting. Here is what I have so far [SOLVED] #include "std_lib_facilities.h" char* strdup(const char* p) { int count = 0; while(p[count]) ++count; char* q = new char[count+1]; for(int i = 0; i < c...

heap & free homework question

I post this here as a last resort. I'm completely stuck and do not know where to take this. With this question, I'm looking for direction rather than the answer. I've got a home work assignment that actually appears to be a pretty common assignment. The question is here at page 11. This isn't my assignment but it is one I found on Googl...

Differences between heap pointer allocation

I have the following data structures: struct Inner { int myValue; }; struct Outer { Inner* inner; }; Option 1 If I do the following: Outer outer; outer.inner = NULL; outer.inner = new inner; inner* pInner = outer.inner; and then add a watch for the following 2 values: outer.inner pInner then they are both non-NULL, a...

Deleting pointer sometimes results in heap corruption

I have a multithreaded application that runs using a custom thread pool class. The threads all execute the same function, with different parameters. These parameters are given to the thread pool class the following way : // jobParams is a struct of int, double, etc... jobParams* params = new jobParams; params.value1 = 2; params.value2 ...

Deleting a pointer a different places results in different behaviors (crash or not)

This question is a refinement of this one, which went in a different direction than expected. In my multithreaded application, the main thread creates parameters and stores them : typedef struct { int parameter1; double parameter2; float* parameter3; } jobParams; typedef struct { int ID; void* params; } jobData; s...

Difference between javacore,thread dump and heap dump in Websphere

Can someone tell me the exact difference between javacore,thread dump and heap dump.Under which situation each of these are used?? ...

Using Heapy's Memory Profile Browser with Twisted.web

I am trying to profile twisted python code with Heapy. For example (pseudo code): from twisted.web import resource, server from twisted.internet import reactor from guppy import hpy class RootResource(resource.Resource): render_GET(self, path, request): return "Hello World" if __name__ == '__main__': h = hpy() por...