[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] making malloc() and free() reentrant safe

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] making malloc() and free() reentrant safe
Date: Sun, 3 Jul 2005 08:19:10 +0200
User-agent: Mutt/

As Russell Shaw wrote:

> >>What stdio functions call malloc?

> >Currently, fdevopen() ..., and the full-featured (...) versions of
> >vfscanf() and vfprintf(). ...

> If the prolog stack-checking code gets done, then it could revert to
> just using the stack.

Curious, what would happen if space on stack is tight then?

Right now, these functions simply skip any floating-point formatting
command if they cannot allocate the buffer, but continue to operate
normally for the remaining parts of the format string.  Also, the
buffer is *only* allocated when a floating-point command is
encountered first (during the current call to vfprintf()), so any
simple ``printf("Hi there, this is round %d\n", counter);'' would not
try to allocate the buffer at all.

Perhaps if the stack checking works, we could use alloca() instead?  I
think it's a builtin in GCC, so no additional code is needed, yet the
remaining behaviour would continue the way it is now.

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]