2012/7/25 Jason Evans <[email protected]>:
> On Jul 24, 2012, at 6:47 PM, Benoit Jacob wrote:
>> I would like to know if jemalloc 3.0 is able to give a list of all
>> currently live blocks, with their exact address and size.
>>
>> By "live block" I mean something that has been returned by malloc (or
>> realloc, etc) and not yet free'd.
>>
>> If that is not possible, is there a "right way" to do so as a local
>> patch to my version of jemalloc (with no particular aim at upstreaming
>> this), or should I simply just instrument the malloc, free, etc.
>> functions?
>
> jemalloc 3 doesn't maintain the data structures necessary to iterate over 
> live blocks, though it would be possible if arenas kept track of all 
> associated chunks so that the chunks could be iterated over.  Several years 
> ago jemalloc had this ability, but I removed it because iteration was quite 
> difficult to safely use (no allocation allowed), and the extra data structure 
> overhead didn't seem warranted, given that the functionality was almost never 
> used.
>
> Thread caches throw a monkey wrench in things, because from the perspective 
> of arena data structures, cached blocks are allocated.  Therefore, it would 
> be necessary to somehow cancel out the effects of caching, by disabling 
> caching, flushing caches before iteration, or masking the cached blocks 
> during iteration.

Thanks for the reply. Based on it, I understand that the better
approach for me is to just instrument the user-facing malloc, free,
etc. functions to allocate bigger blocks and store linked list
pointers in the extra allocated space, to maintain a linked list of
blocks. Let me know if for some reason that idea is bad ;-)

Benoit

>
> Jason
_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to