editbin /heap

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Karel Bijl (Bijl_at_discussions.microsoft.com)
Date: 02/17/05


Date: Thu, 17 Feb 2005 04:13:02 -0800

Hi,

I wonder what editbin /heap does.
According to the documention it sets the size of the heap, the total heap
allocation in virtual memory.

Then I would expect that by using HeapAlloc( GetProcessHeap() ... ) I would
be able to allocate memory from this heap.

But this doesn't seem to be the case!

The program below allocates 1.2 GB from the heap.
This program works fine without using editbin..

However if you do a editbin /heap:1500000000 (1.5 GB) it doesn't work! I
don't understand this.

It's almost as if the part that editbin /heap addresses is not the same heap
as returned by GetProcessHeap().

But if you do a HeapWalk( GetProcessHeap() ... ) you do see this huge 1.5 GB
block there.

How do I allocate memory from the heap that has been modified by editbin
/heap ?

[code]
int main(int argc, char* argv[])
{
   size_t MB = 1024*1024;
   void* p = NULL;
   if( p = HeapAlloc( GetProcessHeap(), 0, 1200 * MB ) )
      printf( "allocation success\n" );
   else
      printf( "allocation failure\n" );
   
   ...
}
[/code]



Relevant Pages

  • Re: Struct inside class
    ... The compiler figures computes the ... including anything derived from "Object": Heap pointer ... memory leaks and why the .NET good garbage collector is required. ... If GC_ALLOCATE can't allocate the requested ...
    (microsoft.public.dotnet.framework)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (comp.lang.cpp)
  • Re: Huge pages and small pages. . .
    ... >> what looks like contiguous memory and away you go. ... you need to have them cached in the TLB; if the TLB runs out of ... > low end of the heap, until someone figures out a way to tell the system ... When you allocate memory, the kernel just marks a promised ...
    (Linux-Kernel)
  • Heap fragmentation (2nd attempt)
    ... But this heap does not fragment, ant the time to allocate memory does not ...
    (comp.arch.embedded)