Re: How to use Delete in right way

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Oleg Starodumov (com-dot-debuginfo-at-oleg)
Date: 01/28/05


Date: Fri, 28 Jan 2005 11:07:01 +0200


> To be precise, pageheap will also detect this when the block
> is deleted, unless the length of the block is a multiple of 8,
> in which case you should get an access violation at the time of
> corruption.
>
> You can use /unaligned parameter with pageheap to force
> it to always place the block exactly at the end of a page
> but this breaks most non-trivial applications because win32 heap
> is documented to have 8 byte alignment, and many apps depend
> on this.
>

This is true for explicit allocations via HeapAlloc.

If the allocation goes through CRT malloc/new/etc, the CRT's allocation
granularity of 16 bytes hides these problems from PageHeap completely,
unless the length of the block is multiple of 16.

Oleg



Relevant Pages

  • Re: what ML language do you recommend?
    ... >>>I think the definition of realtime is just that the gc never imposes ... >allocation patterns that are less dynamic and would benefit from GC ... working with multiple mutators and it never performed well enough IMO ... > systems with relatively long deadlines ...
    (comp.lang.functional)
  • Re: Full pageheap not detecting Access overrun
    ... The debug bersion of the C-Runtime adds padding at the end of the ... The C-Runtime heap will had more padding, and will interfear with the basic ... >> I have tried to use Full pageheap for detecting Heap corruptions. ... > The reason is the allocation granularity of CRT heap. ...
    (microsoft.public.vc.language)
  • Re: how much does free free?
    ... Free does not free the same amount of memory as the size of the malloc ... free must release a multiple of 4 or 8 ... might ask this question is to find out what the system overhead ... allocated by the call to an allocation function, calloc, ...
    (comp.lang.c)
  • Re: returning multiple values vs a list
    ... > return a list and let callers use DESTRUCTURING-BIND. ... > wanted only the primary value then multiple values would be the way to ... Multiple values can be implemented without heap allocation; ...
    (comp.lang.lisp)
  • Re: Full pageheap not detecting Access overrun
    ... > when we ran with full pageheap. ... > Can somebody explain why full pageheap does not detect this access overrun? ... The reason is the allocation granularity of CRT heap. ... Regards, ...
    (microsoft.public.vc.language)