malloc_usable_size

1,661 views
Skip to first unread message

Louise Cypher

unread,
Jun 10, 2010, 3:22:01 PM6/10/10
to andro...@googlegroups.com
Hi

is there anything special that I need to do to use 'malloc_usable_size' function
the prototype: extern size_t malloc_usable_size(void*  block); exist in malloc.h
(i'm building for android 2.1 - so in android-5 dir)
but linker throws:
undefined reference to `malloc_usable_size'

(and yes I'm linking to libc.a (-lc in make switches))
from what I see malloc_usable_size symbol exist in libc ... so i dont know what linker wants from me, the prototype is different from the one in headers or what ?

(i'm trying to put small memory allocation logger / debuger)

--
--
Code it black!

David Turner

unread,
Jun 10, 2010, 5:18:43 PM6/10/10
to andro...@googlegroups.com
malloc_usable_size is not available anymore, if I recall correctly. This function really exposes an implementation detail
of the library, no sane code should rely on that, really. I don't remember why it was there in the first place.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Louise Cypher

unread,
Jun 11, 2010, 4:35:19 PM6/11/10
to andro...@googlegroups.com
well i need it only to check if the given pointer have the size >= expected one in debug build,
now i need to store ptr size or wrap the whole malloc.

that same function exist both for ps3, win and xbox360 platform ... why it is removed from android :)
IMHO it is usefull in some mem problems debuging scenarios ...

Onur Cinar

unread,
Jun 11, 2010, 5:36:39 PM6/11/10
to android-ndk

Hi Louise,

Looks like it is not removed but actually renamed to
dlmalloc_usable_size. I didn't had a chance to check if it works, but
I thought that you may want to give it a try.

But having it renamed also means that it may disappear at anytime, so
be prepared for that as well.

I'm sure there is a reason for taking it out, so I'm agree with David
that you may want to avoid using it if you can.

Regards,

-onur






---
www.zdo.com

David Turner

unread,
Jun 11, 2010, 7:58:01 PM6/11/10
to andro...@googlegroups.com
do not use this. We may very well change the memory allocator in future releases of the platform
and this will break.

Louise Cypher

unread,
Jun 13, 2010, 4:44:34 PM6/13/10
to andro...@googlegroups.com

This will be used only in debug builds, so its OK: )

On 12 Jun 2010 01:58, "David Turner" <di...@android.com> wrote:

do not use this. We may very well change the memory allocator in future releases of the platform

and this will break.



On Fri, Jun 11, 2010 at 2:36 PM, Onur Cinar <onur....@gmail.com> wrote:
>
>
> Hi Louise,
>

> Loo...

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.

T...

Reply all
Reply to author
Forward
0 new messages