Re: Maximum size for allocating memory

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

From: Tim Robinson (tim.gaat.freeserve.co.uk_at_nowhere.com)
Date: 02/04/05


Date: Fri, 04 Feb 2005 22:20:22 +0000

Drew Myers wrote:
> Is there a maximum size that can be passed to malloc?
>
> Large allocations are giving this message in the output window:
>
> HEAP[MyApp.exe]: Invalid allocation size - B1DA4F78 (exceeded 7ffdefff)
>
> Is this an error message? Should I care about this?

This is Windows' way of telling you: You've attempted to allocate more
than the 32-bit Windows architecture can ever handle (which is a touch
under 2GB, hence the number 0x7ffdefff). You're trying to allocate
almost 2.78GB in a single request. If this is what you really want, then
you should either take a serious look at your design, or move to 64-bit
Windows. If this isn't what you want, then you've likely got a bug in
your program.

-- 
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/


Relevant Pages

  • Mp3 player not allocated a volume
    ... player has developed a fault where Windows XP does not allocate it a volume. ... The player is detected by Windows XP, shown in both device manager and safely ... In disk manager it is recognised but not allocated a ...
    (microsoft.public.windowsxp.hardware)
  • Re: Active Directory Failure
    ... Windows 2000 and in Windows Server 2003 ... Service Was Unable to Allocate a Relative Identifier" ... > I believe that this is because the RID Master has reached> its maximum RID Pool Allocation, however I am open to> offers. ...
    (microsoft.public.win2000.security)
  • Re: non-paged memory inside a kernel driver
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... With their stuff running I cannot allocate 10 MB 's on a XP system. ... so I need 100MB of non-paged memory inside my driver. ...
    (microsoft.public.development.device.drivers)
  • Re: KeWaitForMultipleObjects
    ... You are correct you must allocate the WaitArray from NonPagedPool. ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... This is the address of the array of wait objects passed in to the function. ...
    (microsoft.public.development.device.drivers)
  • Re: malloc and realloc
    ... not allow you to allocate this much. ... ALWAYS check the result of malloc to ... Actually Windows guarantees that allocations of under 8K or something like ... even if the amount of memory requested is small". ...
    (comp.lang.c)