heap

Deleting Part of An Array in Java to Free Memory on Heap

I am implementing a dynamic programming algorithm for the knapsack problem in Java. I declare the array and then initialize its size to be [number of objects][capacity of knapsack]. When my number of objects or my capacity gets too large, I get a memory error because I run out of space on the heap. My questions is: If I delete rows...

A Strange Problem in Heap Memory!

I found one thread of a multi-threaded application to be crashing in VxWorks. I don't have debug information. On deeper analysis I found that the crash is being caused due to a global memory address value being changed. This global memory address (which is an address to a function. I am using a function pointer) is being stored at a pa...

MEMORY(HEAP) vs. InnoDB in a Read and Write Environment

I want to program a real-time application using MySQL. It needs a small table (less than 10000 rows) that will be under heavy read (scan) and write (update and some insert/delete) load. I am really speaking of 10000 updates or selects per second. These statements will be executed on only a few (less than 10) open mysql connections. The...

Is there Any Limit on stack memory!

I was going through one of the threads. A program crashed because It had declared an array of 10^6 locally inside a function. Reason being given was memory allocation failure on stack leads to crash. when same array was declared globally, it worked well.(memory on heap saved it). Now for the moment ,Let us suppose, stack grows downwar...

Is there an easy way to make a min heap in C++?

I'm very new to C++, and I was wondering if there was a way to make a min heap in C++ from the standard library. Thanks, ...

Stack memory in Android

I'm writing an app that has a foreground service, content provider, and a Activity front end that binds to the service and gets back a List of objects using AIDL. The service does work and updates a database. If I leave the activity open for 4-8+ hours, and go to the "Running Services" section under settings on the phone (Nexus One) an ...

recursion using only heap area

Are there examples of recursion using only heap area? ...

jvm issue at startup

I can set the max memory as 1000 and not more than that, if I set the memory more than that, it throws the following error. Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. My question is, why jvm looks for the max memory at startup? Thanks in advance....

Interpreting the results of a VisualVM profiling session

I have an application that writes some data (about 15mb in 80k tuples) into an SQLite database using this jdbc-driver on Mac OS X. This is done using transactions, the largest of which contains about 45k inserts into one table. When profiling the application, several things seems strange: If I pause the application right at the beginni...

C++ STL make_heap and pop_heap not working.

I need to use a Heap, so i've searched about the STL one, but it doesn't seem to work, i wrote some code to explain what i mean: #include <stdio.h> #include <stdlib.h> #include <vector> #include <algorithm> struct data { int indice; int tamanho; }; bool comparator2(const data* a, const data* b) { return (a->tamanho < b->t...

operator "new" returning a non-local heap pointer for only one class ?

Language : C++ Platform : Windows Server 2003 I have an exe calling a DLL. EDIT : (exe is not doing anything, it calls few global function which does everything related to DLL within DLL. It does not explicitly new any of DLL classes) I allocate (new) the memory for class A within the DLL, it returns me a non-local heap pointer. I...

Class members allocation on heap/stack? C++

If a class is declared as follows: class MyClass { char * MyMember; MyClass() { MyMember = new char[250]; } ~MyClass() { delete[] MyMember; } }; And it could be done like this: class MyClass { char MyMember[250]; }; How does a class gets allocated on heap, like if i do MyClass * Mine = new MyClass(); Does th...

Heap Error in C++

Dear all, I'm a beginner programmer in C++. Recently, I'm working on image processing thing using C++. but I have some problem that I want to ask. Suppose I have some code as follow: for (int i=0;i<100000;i++) { int * a = new int[10000]; //do something delete [] a; } When I executed that code, I receive runtime error, Heap Err...

Critique my heap debugger

I wrote the following heap debugger in order to demonstrate memory leaks, double deletes and wrong forms of deletes (i.e. trying to delete an array with delete p instead of delete[] p) to beginning programmers. I would love to get some feedback on that from strong C++ programmers because I have never done this before and I'm sure I've d...

Increasing JRE Memory Usage in Eclipse

I read in another question that you can increase the JRE memory allowance for an app through Window -> Preferences in Eclipse, but I can't seem to find anything related to heap memory allocation. Editing -xms/xmx values in eclipse.ini doesn't help since those are for Eclipse itself. ...

Critique my non-intrusive heap debugger

This is a follow-up to Critique my heap debugger from yesterday. As suggested by bitc, I now keep metadata about the allocated blocks in a separate handwritten hashtable. The heap debugger now detects the following kinds of errors: memory leaks (now with more verbose debugging output) illegal pointers passed to delete (that also takes...

Thread safety with heap-allocated memory

I was reading this: http://en.wikipedia.org/wiki/Thread_safety Is the following function thread-safe? void foo(int y){ int * x = new int[50]; /*...do some stuff with the allocated memory...*/ delete [] x; } In the article it says that to be thread-safe you can only use variables from the stack. Really? Why? Wouldn't subse...

How can a 1Gb Java heap on a 64bit machine use 3Gb of VIRT space?

I run the same process on a 32bit machine as on a 64bit machine with the same memory VM settings (-Xms1024m -Xmx1024m) and similar VM version (1.6.0_05 vs 1.6.0_16). However the virtual space used by the 64bit machine (as shown in top under "VIRT") is almost three times as big as that in 32bit! I know 64bit VMs will use a little more m...

Heap Consistency Checking on Embedded System

I get a crash like this: #0 0x2c58def0 in raise () from /lib/libpthread.so.0 #1 0x2d9b8958 in abort () from /lib/libc.so.0 #2 0x2d9b7e34 in __malloc_consolidate () from /lib/libc.so.0 #3 0x2d9b6dc8 in malloc () from /lib/libc.so.0 I guess it is a heap corruption issue. uclibc does not have mcheck/mprobe. Valgrind does not seem to ...

OutOfMemoryError what to increase and how?

I have a really long collection with 10k items, and when running a toString() on the object it crashes. I need to use this output somehow. 05-21 12:59:44.586: ERROR/dalvikvm-heap(6415): Out of memory on a 847610-byte allocation. 05-21 12:59:44.636: ERROR/dalvikvm(6415): Out of memory: Heap Size=15559KB, Allocated=12932KB, Bitmap Size=61...