Re: Documentation on Guard Malloc system level interface?
Re: Documentation on Guard Malloc system level interface?
- Subject: Re: Documentation on Guard Malloc system level interface?
- From: Ken Thomases <email@hidden>
- Date: Sun, 9 Jan 2011 02:18:05 -0600
On Jan 9, 2011, at 1:04 AM, Yuri wrote:
> On 01/08/2011 16:51, Ken Thomases wrote:
>>> I know Guard Malloc has the capability to capture all memory allocations and doesn't require other libraries to be explicitly linked to it.
>>> > Herehttp://developer.apple.com/library/mac/#documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html is its user-side interface.
>>> > Where can I find its system-side interface? How does it get malloc calls?
>>>
>> It's not "capturing" memory allocations. It "gets" malloc calls by being the malloc library. It is directly called by anything trying to allocate memory. The documentation you linked to explains it:
>>
>> "Guard Malloc is a special version of the malloc library that replaces the standard library during debugging."
>>
>
> Guard Malloc has different interface compared to libSystem.B.dylib. For example, libSystem.B.dylib exports malloc symbol, and libgmalloc.B.dylib imports it.
> Hence was my question: what is the system interface of libgmalloc.B.dylib? How exactly does libgmalloc.B.dylib is being plugged in to be a malloc library?
It's using "DYLD interposing" to substitute its own functions in place of the malloc functions of libSystem. DYLD interposing of system APIs is pretty much impractical for anybody but Apple to use, since it is sensitive to exact symbol locations, which can change with any system update.
Regards,
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden