heap

How to find the number of objects in the heap

How can I find the number of live objects on the heap in Java program? ...

Priority queue with dynamic item priorities.

I need to implement a priority queue where the priority of an item in the queue can change and the queue adjusts itself so that items are always removed in the correct order. I have some ideas of how I could implement this but I'm sure this is quite a common data structure so I'm hoping I can use an implementation by someone smarter than...

When object is contructed statically inside a function, would it be allocated on the heap or on the stack?

if i have the following code: for (...) { A a; } would a be allocated on the heap or on the stack? ...

Big O for this recursive algorithm

I did the following algorithm involving a Binary Heap structure: Algorithm: heapMinimum(node) Input : Position n Output : Sequence minList; containing the postions that hold the minimum value 1. minList <-- sequence 2. if parent(node) == NULL // current node is the root of the tree 3. minList.insertLast(node) 4. if (leftchild(no...

Circular buffer in VB.NET

How can I create a circular buffer on the heap in VB.NET ? This would be used for audio playback via P/Invoke to winmm.dll waveoutopen and waveoutwrite to support development of a software synth. I currently use the marshall class to build a regular array of bytes in the heap. ...

Min Binary Heap issue

Hi all, i need help with this minheap code: #include < vector> using namespace std; class heap { vector <int> v; public: int hSize() { return v.size(); } int rsize() { return hSize() - 1; } int parent(int i) { return ...

what happens when tried to free memory allocated by heap manager, which allocates more than asked for?

This question was asked to me in an interview. Suppose char *p=malloc(n) assigns more than n,say N bytes of memory are allocated and free(p) is used to free the memory allocated to p. can heap manager perform such faulty allocation ? what happens now, will n bytes are freed or N bytes are freed? is there any method to find how much m...

Weird behavior of malloc()

Trying to understand answers to my question http://stackoverflow.com/questions/2336345/what-happens-when-tried-to-free-memory-allocated-by-heap-manager-which-allocates I wrote this function and puzzled by its output int main(int argc,char **argv){ char *p,*q; p=malloc(1); strcpy(p,"01234556789abcdefghijklmnopqrstuvwxyz"); //si...

Program crashes only in Release mode outside debugger

Hi, I have quite massive program (>10k lines of C++ code). It works perfectly in debug mode or in release mode when launched from within Visual Studio, but the release mode binary usually crashes when launched manually from the command line (not always!!!). The line with delete causes the crash: bool Save(const short* data, unsigned i...

Corruption of the heap & F12 Problem

Hi everyone ! I'm trying to draw a line using GLUT with C++ - the IDE is VS 2008 -but an error message occurred : Windows has triggered a breakpoint in Graphics.exe. This may be due to a corruption of the heap, which indicates a bug in Graphics.exe or any of the DLLs it has loaded. This may also be due to the user ...

Java consumes too much memory

Hello, my Java written application consumes way too much memory. How does program work : User selects a date from calendar (GUI) and application loads data into JTable component. Everytime data is loaded, new TableModel is created and set. No new JTable is created, just model. What is the problem? : every new day selection from calenda...

How to find size of heap present in Linux?

Hello, I have a Linux running on a ARM Cortex-A8 processor board. The version of the kernel is obtained by (uname -a): Linux 2.6.29-dirty #2 Fri Jan 29 16:54:21 IST 2010 armv7l unknown To debug some of my application which crashes due to malloc() failure(The size i am mallocing is large), and the board has 208 MB DRAM. On this Linux/b...

Maven easyb plugin java heap space settings?

Hi, I attempted to change my heap size for maven easyb plugin http://www.easyb.org/maven-easyb-plugin/. In my easyb test I added standard code to print the heap size using the code Runtime.getFreeMemory() and Runtime.getTotalMemory(). I tried setting the MAVEN_OPTS=-Xmx1024m -Xms1024m and also set the maven opts in Maven surefire ...

Which pointer to delete?

I'm trying to multithread something and i have my program set up such that i have a structure/class of variables that will be passed into each thread for processing. In this class, there are variables that hold pointers to arrays some threads have common arrays from which they read data off of, instead of duplicating those arrays, point...

How to use existing Eclipse MAT indexes for interactive analysis

I am attempting to use Eclipse MAT (Memory Analysis Toolkit) to analyze some rather large heap dumps (~2G). My laptop unfortunately has 32bit Windows, and MAT runs out of heap space @ 1.4G allocated heap. I was successful in running the heap indexer from the command line on a large, headless 64bit box. However, I am unable to convince...

Dynamically setting maximum heap size for java process

I have a Java program that is launched by a batch file with a line like this: javaw -Xms64m -Xmx1024m com.acme.MyProgram However, on some computers the program will not launch and displays the following message: Could not reserve enough space for object heap. Could not create the Java virtual machine. The problem seems to be t...

Where to find the heap dump after an "Out Of Memory"

Hi! I'm using ASANT to run a xml file which points to a NARS.jar file. I'm getting "java.lang.OutOfMemoryError: Java heap space" and i'm researching around this. So i have found that i need to set "-XX:+HeapDumpOnOutOfMemoryError", to create a dump file to analyze. I edited ASANT.bat and added the "-XX:+HeapDumpOnOutOfMemoryError" to ...

Getting Out Of Memory: Java heap space, but while viewing heap space it max uses 50 MB

Hi! I'm using ASANT to run a xml file which points to a NARS.jar file. (i do not have the project file of the NARS.jar) I'm getting "java.lang.OutOfMemoryError: Java heap space. I used VisualVM to look at the heap while running the NARS.jar, and it says that it max uses 50 MB of the heapspace. I've set the initial and max size of heap...

IBM JRE 1.5 will not startup with the requested 1.5G memory

IBM JRE 5.0 on Windows, when given -Xmx1536m on a laptop with 2GB memory, refuses to start up: error message below. With -Xmx1000m it does start. Also, it starts fine with -Xmx1536m on other servers and even laptops, so I think that there is something more than just inadequate memory. Also, when started from within Eclipse (albeit, u...

What's the connection between the heap used in dynamic memory allocation and the data structure?

Possible Duplicate: Why are two different concepts both called heap? I've googled around, but cannot find the answer for this question; what's the connection between the heap used in dynamic memory allocation and the data structure? Is memory organized on the heap in a way which is similar the the heap data structure? If so, t...