This is the mail archive of the
mailing list for the glibc project.
Re: [patch] Avoid the use of mmap as buffer for stdio streams
- From: Wolfram Gloger <wmglo at dent dot med dot uni-muenchen dot de>
- To: arjan at linux dot intel dot com
- Cc: libc-alpha at sourceware dot org
- Date: 25 Nov 2006 18:40:12 -0000
- Subject: Re: [patch] Avoid the use of mmap as buffer for stdio streams
- References: <4566DE80.email@example.com>
> 1) it's now no longer a good idea to use fopen and friends inside the
> malloc() implementation (that doesn't seem to happen anyway)
That cannot happen, not even in a custom malloc implementation,
because fopen already calls malloc for its FILE object..
However, I just re-read the discussion from December 1996 (wow,
we're approaching 10 years of glibc, where's the party BTW?).
The reason to switching to mmap() for file buffers was the fact that a
zeroed buffer is required. Before the switch to mmap, calloc() was
used and _this_ was not present in all custom malloc implementations,
notably bash's at the time.
Although I think "custom mallocs not providing calloc()" is by now
probably not a very strong argument, the fact that zeroed memory is
required somewhat weakens the disadvantages of using mmap.