Iterating over DSS

Dmitry Antipov dmantipov at yandex.ru
Thu Oct 27 02:15:46 PDT 2011


Hello,

is there a method to iterate over DSS heap and find all used/free regions?
(I'm trying to see how much my DSS heap is fragmented). I.e. I would like to
do something like:

void *ptr;
size_t size;

malloc_mutex_lock(&dss_mtx);
ptr = dss_base;
fprintf(stderr, "DSS start: %p\n", ptr);

while (ptr < dss_prev) {
         if (ptr_is_a_pointer_to_allocated_block) { /* How to check this ? */
	        size = ivsalloc(ptr);
		fprintf(stderr, "used: %p..%p\n", ptr, ptr + size);
         } else
		ptr = (char *)ptr + sizeof (void *);
}

fprintf(stderr, "DSS end: %p\n", dss_prev);
malloc_mutex_unlock(&dss_mtx);

Dmitry



More information about the jemalloc-discuss mailing list