Malloc Problem in glibc 2.2
Wolfram Gloger
wmglo@dent.med.uni-muenchen.de
Mon Jul 17 03:23:00 GMT 2000
Hello,
> It would be according to the docu:
> @item M_MMAP_MAX
> The maximum number of chunks to allocate with @code{mmap}. Setting this
> to zero disables all use of @code{mmap}.
> @end table
>
> Please send a patch,
OK here it is. Thanks.
Regards,
Wolfram.
2000-07-17 Wolfram Gloger <wg@malloc.de>
* malloc/malloc.c (chunk_alloc): Use mmap_chunk() only if allowed,
i.e. if n_mmaps_max>0.
Index: libc/malloc/malloc.c
===================================================================
RCS file: /cvs/glibc/libc/malloc/malloc.c,v
retrieving revision 1.63
diff -u -r1.63 malloc.c
--- malloc.c 2000/06/28 23:27:03 1.63
+++ malloc.c 2000/07/17 10:18:15
@@ -2942,8 +2942,8 @@
{
#if HAVE_MMAP
/* A last attempt: when we are out of address space in the arena,
- try mmap anyway, disregarding n_mmaps_max. */
- if((victim = mmap_chunk(nb)) != 0)
+ try mmap anyway, as long as it is allowed at all. */
+ if (n_mmaps_max > 0 && (victim = mmap_chunk(nb)) != 0)
return victim;
#endif
return 0; /* propagate failure */
More information about the Libc-hacker
mailing list