06.01.2016 05:41
4) malloc(0) in glibc returns a valid pointer to something(!?!?) while in
uClibc calling malloc(0) returns a NULL. The behavior of malloc(0) is listed
as implementation-defined by SuSv3, so both libraries are equally correct.
This difference also applies to realloc(NULL, 0).
I personally feel glibc's behavior is not particularly safe. To enable glibc behavior, one has to
explicitly enable the MALLOC_GLIBC_COMPAT option.
4.1) glibc's malloc() implementation has behavior that is tunable via the
MALLOC_CHECK_ environment variable. This is primarily used to provide extra
malloc debugging features. These extended malloc debugging features are not
available within uClibc. There are many good malloc debugging libraries
available for Linux (dmalloc, electric fence, valgrind, etc) that work much
better than the glibc extended malloc debugging. So our omitting this
functionality from uClibc is not a great loss.
http://oopsmonk.blogspot.com/2011/01/uclibc-and-glibc-differences.html
[0] "201601060541-136755270728-0.jpg"
|