heap

How to get just free heap size (not together w stack/method mem) in Java?

I want to calculate the heap usage for my app. I would like to get a procent value of Heap size only. How do I get the value in code for the current running app? EDIT There was an upvoted answer that was NOT complete/correct. The values returned by those methods include stack and method area too, and I need to monitor only heap size. ...

How can I tell if CString allocates memory on the heap or stack?

How can I tell if the MFC CString allocates memory on the heap or stack? I am compiling for the Windows Mobile/Windows CE platform. I am working on a project developed by someone else and I have witnessed stack overflows under certain circumstances. I am trying to figure out if the custom SQLite recordset classes (with many CString ...

Jmap can't connect to to make a dump

We have an open beta of an app which occasionally causes the heapspace to overflow. The JVM reacts by going on a permanent vacation. To analyze this I would like to peek into the memory at the point where it failed. Java does not want me to do this. The process is still in memory but it doesn't seem to be recognized as a java process. ...

Neo4j OutOfMemory problem

Hi! This is my source code of Main.java. It was grabbed from neo4j-apoc-1.0 examples. The goal of modification to store 1M records of 2 nodes and 1 relation: package javaapplication2; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.Transa...

How to list all managed objects in heap in .Net?

Hi, is it possible to list all objects stored in heap. I would like to do something like this: IEnumerable<GCHandle> listOfObjectsInHeap = GetListOfObjectsFromHeap(); ...

Android edtftpj/PRo SFTP heap worker problem

Hi I am using edtftpj-pro3.1 trial copy in my android app to make SFTP connection with the server. After few connections with the server with 5-6 file transfers, my app is crashing with following exception. Is it causing the problem or what could be the problem?? I tried setParallelMode(false) in SSHFTPClient, but it is not working. E...

Heap Behavior in C++

Is there anything wrong with the optimization of overloading the global operator new to round up all allocations to the next power of two? Theoretically, this would lower fragmentation at the cost of higher worst-case memory consumption, but does the OS already have redundant behavior with this technique, or does it do its best to conser...

How can you explore the managed heap in a .NET application to identify possible memory optimizations?

We have a .NET application which our customers consider too large for mass deployment and we would like to understand what contributes to our memory footprint and is it possible to do any better without completely abandoning .NET and wpf. We are interested in improving both Total Size and the Private Working Set (pws). In this question...

"java.lang.OutOfMemoryError: Java heap space" in image and array storage

I am currently working on an image processing demonstration in java (Applet). I am running into the problem where my arrays are too large and I am getting the "java.lang.OutOfMemoryError: Java heap space" error. The algorithm I run creates an NxD float array where: N is the number of pixel in the image and D is the coordinates of each ...

java heap allocation

I tried to increase the heap size like the below C:\Data\Guru\Code\Got\adminservice\adminservice>java -Xms512m -Xmx512m Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -client to select the "clie...

C++: Delete a struct?

I have a struct that contains pointers: struct foo { char* f; int* d; wchar* m; } I have a vector of shared pointers to these structs: vector<shared_ptr<foo>> vec; vec is allocated on the stack. When it passes out of scope at the end of the method, its destructor will be called. (Right?) That will in turn call the destr...

How to prove worst-case number of inversions in a heap is Ω(nlogn)?

I am busy preparing for exams, just doing some old exam papers. The question below is the only one I can't seem to do (I don't really know where to start). Any help would be appreciated greatly. Use the Ω(nlogn) comparison sort bound, the theta(n) bound for bottom-up heap construction, and the order complexity of insertion sort to show ...

GCC/XCode equivalent of _CrtCheckMemory?

When dealing with random memory overwrites, in MSVC it is possible to validate the state of the heap at various points with a call to _CrtCheckMemory, and know with at least a small level of confidence that the code up until the check was not responsible for any errors that might cause new or malloc to fail later. In XCode, whats the eq...

Is an Object the smallest pageable unit in the Heap?

Hi, If I have a 2 GB ram and I have an 2 instances of an Object which is 1.5 GB each, the operating system will help and context switch the pages to and from harddisk. What if I have 1 instances but is 3 GB. Can the same paging method breakdown this instances into 2 pages? Or will I encounter out-of-memory issue? I will also like to ...

Retrieve Heap memory size and its usage statistics etc...?

Lets say I open some application or process. Did some work with that. Now I closed it. Need to know whether this application caused any memory leak. i.e used up some heap memory and not cleared it properly. Can I get this statistics some how? I'm using Visual Studio (for development) under Windows OS. Even I would be interested in kno...

why is stack and heap both required for memory allocation

I've searched a while but no conclusive answer is present on why value types have to be allotted on the stack while the reference types i.e. dynamic memory or the objects have to reside on the heap. why cannot the same be alloted on the stack? ...

C++: Strange behaviour of `new`

Hi, SDL provides me this struct: typedef struct SDL_Rect { Sint16 x, y; Uint16 w, h; } SDL_Rect; I want to create a new SDL_Rect on the heap as class variable: // Forward declaration private: SDL_Rect *m_pcScreenRect; And in the constructor I do this: /* Screen Rectangle (for clearing) */ m_pcScreenRect = new SDL_Rect...

Liquibase, "Migration Failed: Java heap space" error when generateChangeLog with "data"

Hi all I am trying to create a baseline on one of my development database using liquibase, here's my environment - Database, -> Oralce 10g, with 500+ Tables with lots of configuration data, the oracle export dump file is about 70mb; - Java - Java 6 - Oracle JDBC Driver - ojdbc14.jar (downloaded from Oracle web site) - Command line execu...

min heap and max heap

Hi I have studied min heap and max heap and I have these questions that - a sorted array is a min heap? - where is the minimum value of a max heap? please help me thanks {if you put some link I will be so glad} ...

about heap(max-heap and min heap)

Hi I have this question that in the heap data structure , a left child can be more than a right child in its own level ? I mean that consider these three numbers 9,5,8 and I want to make a max-heap data structure so the root will be 9 and is it true that 8 be its left child and 5 be its right child? please help me thanks ...