Re: malloc_size nowhere?
Re: malloc_size nowhere?
- Subject: Re: malloc_size nowhere?
- From: email@hidden (Andrew Demkin)
- Date: Mon, 12 Aug 2002 21:21:19 -0700
At 12:07 AM 8/13/02, Cameron Hayne wrote:
>
On Monday, August 12, 2002, at 03:57 am, Pierre-Olivier Latour wrote:
>
> according to the "man malloc" doc, "size_t malloc_size(void
>
> *ptr)" is supposed to be defined in stdlib.h, but it's not the case
>
> and I
>
> can't find it anywhere...
>
>
It's declared in /usr/include/objc/malloc.h
Just beware of what malloc_size() actually measures. It returns the full
size of the block that malloc() used to fulfil your request -- not
necessarily the value you passed in.
For example, I just did a test to allocate 3 chars of storage --
malloc_size() returned 14.
The only way to recover the actual size value you passed to malloc() is to
record it in your own data structure.
HTH,
Andrew.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.