Re: API used to access process heap structure
Re: API used to access process heap structure
- Subject: Re: API used to access process heap structure
- From: Martin Knapp-Cordes <email@hidden>
- Date: Mon, 11 Sep 2006 15:54:14 -0400 (EDT)
Hi Michael,
Thank you for you detailed explanations. Is there any
source of a version of heap that I could look at to help
me translate what you are saying? It doesn't appear that the
darwin version is published. The man page says
it is of BSD origin, but I can't seem to find any trace
of it on the freebsd website. I am sure I am not looking
in the right place. Any help would be appreciated.
Sincerely,
Martin Knapp-Cordes
---------------------------------------------------------------
| Martin Knapp-Cordes email@hidden |
| The MathWorks, Inc. http://www.mathworks.com |
| 3 Apple Hill Drive Natick, MA 01760 |
| Tel: (508) 647-7321 Fax: (508) 647-7015 |
---------------------------------------------------------------
On Fri, 8 Sep 2006, Michael Smith wrote:
>
> On Sep 8, 2006, at 12:02 PM, email@hidden wrote:
>
> > Windows has an API to walk the heap associated with a process.
> > There is no POSIX API for UNIX as far as I know. So it will be
> > different for each UNIX variant. Darwin has a heap(1) utility which
> > clearly uses an API to get the information. You can see some of
> > that by
> > looking at the output of nm. However, I have been unable to
> > find any published documentation about it. I am interested
> > for example in extracting information about the blocks on the
> > free list.
>
> There is no published documentation on these interfaces, and they are
> not considered API.
>
> Before we start talking about all this, though, it's important to
> understand
> that under Darwin, malloc & friends are just wrappers around a plugin
> interface that permits multiple instances of multiple allocators to
> co-exist.
>
> In the common case, there's only one allocator, scalable_malloc, but
> quite
> often there will be several instances of it (as you can see if you
> point Heap
> at e.g. Safari).
>
> If you look at <malloc/malloc.h> you will notice that in the
> malloc_zone_t
> structure there is a pointer to a malloc_introspection_t structure,
> which is
> defined further down.
>
> In this structure are a number of useful function vectors. One of these
> is the enumerator.
>
> Now, it's important to understand that in a utility, the enumerator
> comes
> from the utility's copy of the system library, but if you have set up
> the reader
> hook to read from another process' address space, you are looking at
> data
> structures maintained by that process' copy, which may not be the same
> (e.g. Rosetta, 32 vs. 64 bit, etc.).
>
> This particular interface won't tell you what's on the freelist, I'm
> afraid,
> and you will spend some time digging the zone_address parameter
> up if you are introspecting another process (easy enough on your own
> task). But it does largely parallel the Windows facility you described,
> and if you look at the header it's well enough described that you can
> work it out.
>
> HTH
>
> = Mike
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden