On Wed, 23 Dec 2009, Martin Nowack wrote:
On Tuesday 22 December 2009 06:06:28 am Mark Heily wrote:
When I define DISPATCH_DEBUG=1 and build the library under Linux, almost all of the test programs fail. I checked a couple of them, and they both fail a dispatch_assert() test at the same place: in _dispatch_ccache_init().
The reason is that the current implementation of malloc_zone for linux (src/shims/malloc_zone.h) is just a dummy implementation and returns always a null-pointer. Therefore, this assertion will always fail.
The current dummy implementation just dispatches the zone_malloc calls to the normal malloc routine. The attached "patch" circumvents the problem with the assertion by allocating a zone and returning a pointer to it. The behavior of the zone_malloc remains the same.
Hi Martin-- I've committed a slight variation on this patch as r176: specifically, I return (void *)-1 rather than malloc'ing state. As we don't implement the internals of malloc zones, I would rather cause a segfault if a consumer of the API decides to muck around with the internals, as that implies more support for malloc zones than the stubs provide. Could you let me know if this adequately addresses the assertion failures you've been running into? Robert N M Watson Computer Laboratory University of Cambridge