https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64535

Thibaut M. <dumoulin.thibaut at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dumoulin.thibaut at gmail dot 
com

--- Comment #27 from Thibaut M. <dumoulin.thibaut at gmail dot com> ---
With this patch, a global variable is declared and `malloc` is called in its
constructor.

Linking libstdc++ will automatically allocate at least 2528 bytes on the heap.
Since this library is also used in embedded software, this is a problem, 2,5ko
represent a lot of memory (when you have only 4ko available for example). A
temporary solution would be to call the freeres() function but better solution
would be to do not allocate at all.

Second problem with this commit: the constructor of the global variable `pool
emergency_pool` must be call at run time due to `malloc` and `new` functions.
Even if this code is not used, the linker script will put the constructor in
`.init_array` section. Linker cannot get rid of this constructor due to
non-pure functions called.

A patch could be a least to avoid this `malloc` with some `#define` options?

Or maybe you know a solution to avoid those problems?
  • [Bug libstdc++/64535] Emerg... dumoulin.thibaut at gmail dot com via Gcc-bugs

Reply via email to