Freeing __malloc_av and impure_data
Sat Nov 27 13:57:00 GMT 2010
On Nov 26 22:00, Aras Vaichas wrote:
> On 26 November 2010 21:40, Corinna Vinschen <firstname.lastname@example.org> wrote:
> > On Nov 26 15:42, Aras Vaichas wrote:
> > > Hi, I'm building a binary for a non-Linux embedded AVR32 application
> > > and I'm getting close to my 16K of SRAM limit.
> > >
> > > Looking at my elf file, I see that impure_data uses 1K of memory.
> > >
> > > 00000044 l Â Â O .data Â 00000400 impure_data
> > >
> > > I understand that it is somehow used for rentrancy in newlib, but
> > > AFAIK I don't need it.
> > >
> > > Is there a way to reduce this, or remove it completely?
> > You can't just remove it since it's used for more than just reentrency.
> > But you can shrink it for small targets. Â The --enable-newlib-reent-small
> > configure option will do that for you.
> Excellent. I ran the debugger today and saw that about 8 bytes in the
> 1K area were being used, but everything else remained at zero.
> Is --enable-newlib-reent-small a newlib build configuration?
> > You can get rid of it by overriding newlib's malloc with your own
> > malloc. Â Just define MALLOC_PROVIDED so the default malloc functionality
> > will not be built into newlib. Â Alternatively, make sure not to use
> > functions which potentially allocate space dynamically. Â printf is a
> > good candidate.
> Is MALLOC_PROVIDED intended for use in building newlib or for linking
> against newlib?
It's for building newlib. It's usually set from within configure.host.
Cygwin Project Co-Leader
More information about the Newlib