avr-libc-dev
[Top][All Lists]
Advanced

[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: Thu, 30 Jun 2005 06:39:14 +0200
User-agent: Mutt/1.4.2.1i

As Russell Shaw wrote:

> >If you need stdio functions that call malloc, hmm, I think that'll
> >put something else onto your list of non-reentrant functions ;-),
> >but still, you could just import the implementations for
> >malloc/free into your own application, and make them thread-safe.

> What stdio functions call malloc?

Currently, fdevopen() (though I always meant to provide an additional
interface that doesn't need malloc()), and the full-featured (floating
point) versions of vfscanf() and vfprintf().  The latter need a rather
large buffer, and the idea behind malloc()'ing it is that if you setup
__malloc_margin correctly, you could at least fail and bail out if the
memory isn't available (unlike for an automatic variable).  The memory
is released before returning, so there's no risk for memory
fragmentation resulting out if it.

-- 
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]