native: make use of TLSF malloc and co

In order to make native behave more similar to other platforms, it should also use TLSF's dynamic memory allocation if included. It will still fall back to the system's malloc implementation when building for use with valgrind, to leverage its memory leak detection mechanisms.
This commit is contained in:
Oleg Hahm 2015-12-18 13:03:12 +01:00
parent 1d22374196
commit 6d135d3579

View File

@ -134,6 +134,10 @@ void _native_syscall_leave(void)
}
}
/* make use of TLSF if it is included, except when building with valgrind
* support, where one probably wants to make use of valgrind's memory leak
* detection abilities*/
#if !(defined MODULE_TLSF) || (defined(HAVE_VALGRIND_H))
int _native_in_malloc = 0;
void *malloc(size_t size)
{
@ -204,6 +208,7 @@ void *realloc(void *ptr, size_t size)
_native_syscall_leave();
return r;
}
#endif /* !(defined MODULE_TLSF) || (defined(HAVE_VALGRIND_H)) */
ssize_t _native_read(int fd, void *buf, size_t count)
{