heap

What Happens When Stack and Heap Collide

Hi, I am curious to know what happens when the stack and the heap collide. If anybody has encountered this, please could they explain the scenario. Thanks in advance. ...

Stack Frame Question: Java vs C++

Q1. In Java, all objects, arrays and class variables are stored on the heap? Is the same true for C++? Is data segment a part of Heap? What about the following code in C++? class MyClass{ private: static int counter; static int number; }; MyClass::number = 100; Q2. As far as my understanding goes, variab...

Find mapping between Windows heap and modules

Hi all! I am searching for a way to find a mapping between a heap and the module which owns the heap. I retrieve the heaps in the following way: HANDLE heaps[1025]; DWORD nheaps = GetProcessHeaps((sizeof(heaps) / sizeof(HANDLE)) - 1, heaps); for (DWORD i = 0; i < nheaps; ++i) { // find module which created for heap // ... } The ...

max heap usage allowed per process

hi friends i m using malloc to allocate memory and memory requirements are greater than 1GB. so program is crashing... i want to ask whether this problem can be solved??If yes than how?? my RAM size is 3GB and using 32 bit windows os and programming using vc++ ...

LuaJit increase stack/heap size

Hi, I keep getting a out of memory error in LuaJit. How do I increase the stack or heap size? Thanks ...

Fibonacci Heap Issue

I've been working on a Fibonacci Heap implementation in Java for about a week now. It's the implementation based off of the CLRS book. I wanted to see if I would get any performance boost using it in a side project I'm working on compared to Java's default PriorityQueue. [The default implementation in Java is array based, so much more l...

Extract min implemetation for heap in c++

I need to implement extract min for heap(in c++ if possible), could not get this method from STL heap. ...

How can I access Java heap objects without a reference?

I would like to get a reference to all objects in the Java heap, even if I don't immediately have a reference to those objects in my active thread. I don't need non-referenced objects (those "queued" for garbage collection), but would like to get anything that's still in use. The goal is to serialize and store all the objects to implem...

Heap Dump Root Classes

We have production system going into infinite loop of full gc and memory drops form 8 gigs to like 1 MB in just 2 minutes. After taking heap dump it tells me there an is an array of java.lang.Object ([Ljava.lang.Object) with millions of java.lang.String objects having same String taking 99% of heap. But it doesn't tell me which class i...

How to do memory analysis of heap allocated objects in an embedded systems?

I'm trying to analyze the memory usage of our systems. We have some singleton objects that are allocated on the heap at start-up. I would like to get the size of those objects. The information has to be there, since the debugger knows how big they are. How can I dump that info out of dwarf2 debugging information? Our compiler is WindRive...

Which object is created in which part of memory?

public class Order { static Customer cust = new Customer(); string sEmpty = ""; public static void main(String args[]) { int iTotal = 10; string sProductName = "Salt"; Ship shp = new Ship(); } } At the above code, which object and reference is created in the which part of memory? (I mean Hea...

Increase JVM heap size for Scala?

I have a Scala data processing tool which is failing with a java.lang.OutOfMemoryError exception. The tool needs to make a couple passes over a large data file (the one I'm working on is over 700MB), so it would be convenient if the entire thing could be stored in memory. I run the tool from the command line or from a Bash script using ...

How to avoid "(null)" StackTrace in DPH_BLOCK_INFORMATION ?

I'm having a blast tracking down some heap corruption. I've enabled standard page heap verification with gflags /p /enable myprogram.exe and this succeeds in confirming the corruption: =========================================================== VERIFIER STOP 00000008: pid 0x1040: corrupted suffix pattern 10C61000 : Heap handle ...

Defragmenting C++ Heap Allocator & STL

I'm looking to write a self defragmenting memory manager whereby a simple incrementing heap allocator is used in combination with a simple compacting defragmenter. The rough scheme would be to allocate blocks starting at the lowest memory address going upwards and keeping book-keeping information starting at the highest memory address...

Portable way to detect heap fragmentation in c++ at runtime?

I'm writing a qt-based c++ application and i need to be able to detect memory fragmentation in order to check if the current system can actually sustain the memory load: the program load a big image (15/21 megapixels are the norm) in memory and then perform some filtering on it (w/ sparse matrices). For instance, i'm having memory fragme...

How can I implement decrease-key functionality in Python's heapq?

I know it is possible to realize decrease-key functionality in O(log n) but I don't know how? ...

Why is the size of my HeapOverflow program 5MB ?

Hi ! So I was asking myself what would happen if I tried to do a heap overflow on Windows XP, and I was surprise to see that, once the program "ate" all the RAM (this happens instantly, by the way), the size of the process in the task manager goes down to 5MB and doesn't move afterwards. The computer memory usage is still growing, howev...

Java memory mystery (do I have a leak)?

I have a standalone Java problem running in a linux server. I started the jvm with -Xmx256m. I attached a JMX monitor and can see that the heap never really passes 256Mb. However, on my linux system when I run the top command I can see that: 1) First of all, the RES memory usage of this process is around 350Mb. Why? I suppose this is be...

When happens to value types when they're removed from a collection?

Suppose I have some simple struct like this: public struct WeightedInt { public int value; public double weight; } Then let's say I have a collection of instances of this structure: List<WeightedInt> weightedInts = new List<WeightedInt>(); As I understand value types versus reference types, value types are allocated on the ...

Why would you ever want to allocate memory on the heap rather than the stack?

Possible Duplicate: When is it best to use a Stack instead of a Heap and vice versa? I've read a few of the other questions regarding the heap vs stack, but they seem to focus more on what the heap/stack do rather than why you would use them. It seems to me that stack allocation would almost always be preferred since it is quic...