Is the tlsf allocator used by default ?
by Benoit Meister
Hi
I'm systematically using NO_ALLOC in my calls to ocrDbCreate, but in a case
when I try to allocate a small block (16 bytes), it seems that
tlsf-allocator is used.
I was expecting malloc to be used instead.
My understanding is that when using custom allocators, one has to deal with
the fact that the allocators use a part of the allocated space. This
probably rules out allocating a really small buffer like this one. So I
don't want to use any custom allocator (at the moment).
Valgrind tells me this:
==8485== Invalid write of size 4
==8485== at 0x4047FA9: removeFreeBlock (tlsf-allocator.c:408)
==8485== by 0x404845C: tlsf_malloc (tlsf-allocator.c:881)
==8485== by 0x4048599: tlsfAllocate (tlsf-allocator.c:1011)
==8485== by 0x4048C81: regularCreate (regular.c:48)
==8485== by 0x4047B5E: ocrDbCreate (ocr-db.c:67)
tlsf-allocator.c:408 is this line (I have printfs here and there so the
line # may be off):
ST_SIZE(ADDR_OF(header_t, GET_ADDRESS(second), prevFreeBlock),
first.value);
Thanks,
- Benoit
9 years, 2 months