This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
BUG: After malloc(AVAILABLE_HEAP), which returns 0, every malloc, even malloc(0) returns ENOMEM.
- From: Piotr Jedyk <jedaj dot art at gmail dot com>
- To: newlib at sourceware dot org
- Date: Tue, 20 Sep 2016 19:42:53 +0200
- Subject: BUG: After malloc(AVAILABLE_HEAP), which returns 0, every malloc, even malloc(0) returns ENOMEM.
- Authentication-results: sourceware.org; auth=none
Hello!
I think, I have found a bug which cause malloc() to not work, even
malloc(0) without any successful malloc() before, so the heap should
be empty.
Description is available here:
http://stackoverflow.com/questions/39088598/malloc-in-newlib-does-it-waste-memory-after-one-big-failure-allocation
Library was built on x86_64 Debian configured as follows:
CFLAGS_FOR_TARGET='-g3 -O0' \
../configure \
--prefix="$g_tc_install" \
--target="$g_tc_target" \
--disable-newlib-supplied-syscalls \
--with-gmp="$g_tc_install" \
--with-mpfr="$g_tc_install" \
--with-mpc="$g_tc_install" \
--with-isl="$g_tc_install" \
;
Compiled with the bootstraped GCC configured as follows:
LIBGCC2_FLAGS='-g3 -O0' \
../configure \
--prefix="$g_tc_install" \
--target="$g_tc_target" \
--enable-languages='c,c++' \
--enable-__cxa_atexit \
--with-cpu="$g_tc_cpu" \
--with-mode="$g_tc_arm_mode" \
--with-newlib \
--with-headers="$g_tc_build/newlib/newlib/libc/include" \
--with-gmp="$g_tc_install" \
--with-mpfr="$g_tc_install" \
--with-mpc="$g_tc_install" \
--with-isl="$g_tc_install" \
;
Non-path variables was:
export g_tc_target='arm-none-eabi'
export g_tc_cpu='cortex-m7'
export g_tc_arm_mode='thumb'
Version was newlib-2.4.0.20160527, downloaded as a tar.