Re: Reentrant functions and memory allocation
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Sun, 30 Mar 2008 09:11:53 -0500
fmassei@xxxxxxxxx wrote:
I'm trying to put some old code in a portable, cross-platform
library and I'm facing a big problem: is there a standard,
platform-independent way to write a reentrant function that
allocate dynamic memory? In other words: is it safe to use
malloc() or free() in a thread-safe function?
No. Because the malloc system will be operating on it's own memory
areas, and is not re-entrant. You have to ensure that all accesses
to the malloc package are done through appropriate guards.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: Reentrant functions and memory allocation
- From: Eric Sosman
- Re: Reentrant functions and memory allocation
- References:
- Reentrant functions and memory allocation
- From: fmassei
- Reentrant functions and memory allocation
- Prev by Date: Re: ?: as an lvalue
- Next by Date: Re: Reentrant functions and memory allocation
- Previous by thread: Re: Reentrant functions and memory allocation
- Next by thread: Re: Reentrant functions and memory allocation
- Index(es):
Relevant Pages
|