_Heap_Size_of_user_area question

Thomas Rauscher trauscher at loytec.com
Fri Jun 4 09:12:36 UTC 2004


Hi,

I've a question regarding _Heap_Size_of_user_area() ...

I've figured out that it basically returns the front flag of a given
heap block.
In my understanding the size encoded in the front flag also includes
front flag and back flag.
Is this right? If so, the function returns the "user area" + 8.
"user area" is the size given to malloc() plus some alignment bytes to
get to 
a heap page boundary.

While this is not an error itself, I'm wondering whether only the
function 
is unluckily named, I have the wrong understanding of what the "user
area" is,
or the implementation does not match the function intention by accident.

In the last case, the function should subtract the front and back flag
size, so
that the C library can determine the exact amount of data it can store.

Background: I was trying to improve realloc to handle the case of small
increments or
decrements. For example, asprintf does lots of small incrementing
reallocs.

Thanks for any comments,
Thomas.

-- 
Thomas Rauscher
LOYTEC electronics GmbH
Stolzenthalergasse 24/3
A-1080 Wien
Austria/Europe
trauscher at loytec.com
www.loytec.com
Phone: +43-1-4020805-15
FAX:   +43-1-4020805-99




More information about the users mailing list