Re: Question about implementation of new/delete and new[]/delete[] in gnu gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Tim Schumacher:

> Specifically, I was curious about what meta data is stored about the
> allocations (size/# of elements in the array case), and where that
> data is stored.

Certain types require a "cookie" which stores the length, and it is
stored just before the pointer that operator new[] returns.  The rules
for when a cookie is needed are somewhat complex and depend on the ABI
version.  The layout of the cookie field is ABI-dependent as well
(beyond mere differences in word size).

Searching for "cookie" in gcc/cp/*.c should point you into the right
direction.

operator new[] is expanded in-line by the compiler, so most of the
run-time library support routines Jonathan mentioned are not actually
used by GCC, but are provided for use by other compilers.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux