public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* BUG: After malloc(AVAILABLE_HEAP), which returns 0, every malloc, even malloc(0) returns ENOMEM.
@ 2016-09-20 17:43 Piotr Jedyk
  0 siblings, 0 replies; only message in thread
From: Piotr Jedyk @ 2016-09-20 17:43 UTC (permalink / raw)
  To: newlib

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-20 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20 17:43 BUG: After malloc(AVAILABLE_HEAP), which returns 0, every malloc, even malloc(0) returns ENOMEM Piotr Jedyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).