heap

Why are two different concepts both called "heap"?

Why are the runtime heap used for dynamic memory allocation in C-style languages and the data structure both called "the heap"? Is there some relation? ...

Released/production version got heap corruption. Solution preventing it?

In our company we somehow got code to production which crashed(because Heap got corrupted somehow). Developers developed, after that testers had hands on it and later on it was released natural way(monthly release). Everything was fine till it crashed... We tried to investigate it and found many places where we could get a heap corruptio...

Traversing/Setting L and RChild index's in complete Binary Heap C++

Hello, I used a binary heap concept to insert elements in my items array: void BST::insert(const data &aData) { int slot = size + 1; if ( size >= maxSize ) this->reallocate(); while ( slot > 1 && aData < items[slot / 2 - 1].theData ) { items[slot - 1] = items[slot / 2 - 1]; slot = slot / 2; } ...

Peeking in a heap in python

Hi all. What is the official way of peeking in a python heap as created by the heapq libs? Right now I have def heappeak(heap): smallest = heappop(heap) heappush(heap, smallest) return smallest which is arguably, not very nice. Can I always assume that heap[0] is the top of the heap and use that? Or would that assume too much o...

Why Win32 HeapReAlloc() changes values?

Hi there! I'm writing an app in C using win32 API. When I try to enlarge the size of my array, using the HeapRealloc() function, it changes my current values in the array, instead of copying them. The code I use to reallocate memory: BOOL ChangeFeedArraySize(UINT newSize) { char tempChar[20] = ""; PFEED tempArr; if (newSi...

_CrtCheckMemory before and after function return

hi! following code: _CrtCheckMemory(); vector<Vector3> samples = PoissonDisk::generate_poisson(m_resX-1, m_resY-1, minDist, 30, m_samples); _CrtCheckMemory(); int s = samples.size(); the debugger traps into the heapcheck function in the second _CrtCheckMemory() telling me there's something wrong with the heap - so my assumption is th...

jvm heap limit on SUSE

hello, I hope you can help me on the problem we have with SUSE and JDK 1.4.x: my suse is PAE enabled with 15Gb RAM. unfotunately jvm cannot allocate more than 1900Mb for heap size. So java -Xmx2048m gives me an error. it seems you had the same problem, did you solve it? I hope so :) thanks Michelangelo ...

Are there tools to analyse large Java heap dumps without loading the complete hprof file?

I use Eclipse MAT to analyse hprof files. It is very good but if you have a 2Gb heap dump then you need to run MAT with a 2Gb+ heap size itself to be able to load the complete heap dump. I was wondering if anyone knows of a tool that could analyse a 2Gb hprof file without using that much memory itself (e.g. it doesn't load the complete ...

Loading a large hprof into jhat.

I have a 6.5GB Hprof file that was dumped by a 64-bit JVM using the -XX:-HeapDumpOnOutOfMemoryError option. I have it sitting on a 16GB 64-bit machine, and am trying to get it into jhat, but it keeps running out of memory. I have tried passing in jvm args for minimum settings, but it rejects any minimum, and seems to run out of memory be...

Is there any heap compaction in C++?

I have a notion that C++ runtime doesn't do any heap compaction which means that the address of an object created on heap never changes. I want to confirm if this is true and also if it is true for every platform (Win32, Mac, ...)? ...

What is the right tool to detect VMT or heap corruption in Delphi ?

I'm a member in a team that use Delphi 2007 for a larger application and we suspect heap corruption because sometimes there are strange bugs that have no other explanation. I believe that the Rangechecking option for the compiler is only for arrays. I want a tool that give an exception or log when there is a write on a memory address th...

Finding last element in linked structure heap

I was wondering how you would go about finding the furthest element in a linked structure implementation of a heap and the root element. I want to be able to Enque and Deque elements. Some clarification: what I meant was lets say you have a linked structure making up a max heap (root element has the largest value). Your tree would have...

How do I find out Java's heap size on my computer?

Hello, I'd like to be able to get the size of the heap as a variable. I don't need to change the size, just know what it is and have it in a variable. Thanks! ...

Heap size limitation in C

I have a doubt regarding heap in program execution layout diagram of a C program. I know that all the dynamically allocated memory is allotted in heap which grows dynamically. But I would like to know what is the max heap size for a C program ?? I am just attaching a sample C program ... here I am trying to allocate 1GB memory to stri...

Can't open HPROF file with Eclipse Memory Analyzer

Eclipse Memory Analyzer prompts me only with this message: "Invalid HPROF file header". Stack dump: java.io.IOException: Invalid HPROF file header. at org.eclipse.mat.hprof.AbstractParser.readVersion(AbstractParser.java:135) at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:69) at org.eclipse.mat.hprof.HprofInd...

Running out of java heap space- 15 puzzle problem.

G'day all, I tried the solution for eight puzzle problem posted here by joel Neely and played around with it and modified it so that can be used to solve for higher grids[Changed the String representation of the grid to two dimensional integer representation and modified the logic accordingly]. However the modified code can solve th...

How to compress repeating branches in directed graph?

I work a lot with directed graphs resulting from heap dumps of Java programs. One thing that characterizes them is that they contain lots of repeating patterns. I would like to find a way of compressing such patterns whilst still retaining the essential structure of the graph. For instance consider the following "molecules": | ...

Explicitly disallow heap allocation in C++...

I have a number of classes that I would like to explicitly disallow heap allocation for. It occurred to me this weekend that I could just declare operator new private (and unimplemented)... Sure enough, this results in compile errors when you attempt to new the class... My question is: Is there more to this? Am I missing something or is ...

Reason for ~100x slowdown with heap memory functions using HEAP_NO_SERIALIZE on Vista and Windows 7

I'm trying to tracedown a huge slowdown in the heap memory functions in Vista and Windows 7 (I didn't test on any server editions). It doesn't happen on XP at all, only on Microsoft's newer operating systems. I originally ran into this problem with PHP complied on Windows. The scripts themselves seemed to run at the expected speed, but ...

Returning a value type from a property

Hey, I'm getting confused with what happens on the stack and heap in respect to value type properties in classes. My understanding so far: When you create a class with a structure (value type) like this: class Foo { private Bar _BarStruct; public Bar BarStruct { get {return _BarStruct; } set {_BarStruct = value; } } ...