heap

Tools and tutorials for examining the gen 2 heap

So you're at that time in your project when looking at Performance monitor, wondering "why is my gen 2 heap so large??" That's where I am, currently. I'm interested in tools and tutorials for examining the contents of the gen 2 heap (and, by extension, gen 1 and 0 and the LOH). ...

What is the origin of the term "heap" for the free store?

I am trying to find the official (or a good enough) reason that the free store is commonly referred to as the heap. Except for the fact that it grows from the end of the data segment, I can't really think of a good reason, especially since it has very little to do with the heap data structure. Note: Quite a few people mentioned that i...

Visual Studio 2008 - show heap

Hi Is it possible to view the heap and stack during debugging? ...

C# Indexer memory question

Hi I have the following code inside main method: List<Rectangle> rects = new List<Rectangle>(); for (int i = 0; i < 5; i++) { rects.Add(new Rectangle(1, 1, 1, 1)); } foreach (Rectangle item in rects) { Console.WriteLine(item); } rects[1].Inflate(100, 100); foreach (Rectangle item in rects) { Console.WriteLine(item); } ...

How do I create an array in C++ which is on the heap instead of the stack?

I have a very large array which must be 262144 elements in length (and potentially much larger in future). I have tried allocating the array on the stack like so: #define SIZE 262144 int myArray[SIZE]; However, it appears that when I try and add elements past a certain point, the values are different when I try to access them. I under...

Is there a reason to call delete in C++ when a program is exiting anyway?

In my C++ main function, for example, if I had a pointer to a variable which uses heap memory (as opposed to stack memory) - is this automatically deallocated after my application exits? I would assume so. Even so, is it good practice to always delete heap allocations even if you think they will never be used in a situation where the me...

About C/C++ stack allocation

While studying C++ (and C) I had some particular doubts regarding the working of stack allocation, that I can't find a solution to: Does stack allocation call malloc/free functions implicitly? If not; how does it assure there is no conflict between stack allocation and heap allocation? If yes; does stack allocation in C++ implicitly ca...

What is the difference among heap spraying, heap overflow, heap overrun?

What is the difference among heap spraying, heap overflow, heap overrun? Can those terms be replaced with buffer spraying, buffer overflow, buffer overrun? Do they have the same definitions as well? ...

Monitoring Eclipse-plugin heap size *programatically*

I know we can monitor heap size manually by , "Show heap status" under Window -> Preferences -> General So is there anyway to say automatically grab the highest memory used in my eclipse plug-in? This would be convenient to me because my plug-in could run for a long time and monitoring manually is not feasible. Thanks ...

Is dynamically allocated memory (heap), local to a function or can all functions in a thread have access to it even without passing pointer as an argument

Hello, I have a very basic question and need help. I am trying to understand what is the scope of a dynamically allocated memory (on heap). #include <stdio.h> #include <malloc.h> //-----Struct def------- struct node { int x; int y; }; //------GLOBAL DATA------ //-----FUNC DEFINITION---- void funct(){ t->x = 5; //**can I...

How can I categorize the memory usage of a NON-.NET application/DLL ?

I have a 32-bit Visual Studio 8.0 C++ Windows DLL (non-.NET) that appears to be taking up more memory than I would expect. I want to determine exactly where the memory is going, not just a single figure of the total memory used (not interested in Task Manager or Resource Monitor's memory usage values). Back in 16-bit days HeapWalker was...

Please help us non-C++ developers understand what RAII is

Another question I thought for sure would have been asked before, but I don't see it in the "Related Questions" list. Could you C++ developers please give us a good description of what RAII is, why it is important, and whether or not it might have any relevance to other languages? I do know a little bit. I believe it stands for "Resour...

PriorityQueue/Heap Update

Does Java have an easy way to reevaluate a heap once the priority of an object in a PriorityQueue has changed? I can't find any sign of it in Javadoc, but there has to be a way to do it somehow, right? I'm currently removing the object then re-adding it but that's obviously slower than running update on the heap. ...

java.lang.OutOfMemoryError: Java heap space with NetBeans

This is the error I get when I run my web application using NetBeans (using servlets). To fix this I even changed the heap size in netbeans.conf, but still it shows the same error. How can I keep this from happening? HTTP Status 500 - -------------------------------------------------------------------------------- type Exception rep...

VM options in project properties in netbeans

I got a problem with the java heap space while using servlets in netbeans5.0 and got a solution to resolve it too,they asked to change the VM options of run category in the project properties.But,i couldnt find such option in my properties.Please do tell me what to do with this error. This is the picture of my project properties. ...

Get heap dump from a remote application in Java using JVisualVM

I run JVisualVM (Windows XP, Sun Java 1.6.0.13, 32 bit client VM) to monitor a distant application (Linux, Sun Java 1.6.0.07, 64 bit server VM). Before starting the actual remote application, I launch on the remote machine jstatd using an all access policy: grant codebase "file:${java.home}/../lib/tools.jar" { permission java.securit...

Force garbage collection/compaction with malloc().

I have a C++ program that benchmarks various algorithms on input arrays of different length. It looks more or less like this: # (1) for k in range(4..20): # (2) input = generate 2**k random points for variant in variants: benchmark the following call run variant on input array # (3) Is it possible to reset the whole he...

C/C++ pattern to USE_HEAP or USE_STACK

Is there a way to define a macro (or something similar) that would allow objects to be allocated on the stack or on the heap, cleanly? eg. Current code: A a; a.someFunc(); The simplest suggestion might be the following, but as you can see below, it's not very clean to maintain 2 sets of code. #ifdef USE_STACK A a; a.someFunc();...

C++ Implementation of a Binary Heap

I need a min-heap implemented as a binary tree. Really fast access to the minimum node and insertion sort. Is there a good implementation in stl or boost that anyone can point me too? ...

When would I want to use a heap?

Besides the obvious answer of a Priority Queue, when would a heap be useful in my programming adventures? ...