This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How can I use M_MMAP_MAX?


I really expected this to work:

#include <malloc.h>

typedef void (malloc_init_t)   (void);

static malloc_init_t    malloc_init;

malloc_init_t * __malloc_initialize_hook = malloc_init;

static void
malloc_init(void)
{
    mallopt(M_MMAP_MAX, 0);
}

However, all the 132+892K mappings below are mmap-ed:

# pmap 4597|sed '1,/^15de/d'
15dfb000     16K rw---    [ anon ]
15e00000    132K rw---    [ anon ]
15e21000    892K -----    [ anon ]
15f00000    132K rw---    [ anon ]
15f21000    892K -----    [ anon ]
16000000    132K rw---    [ anon ]
16021000    892K -----    [ anon ]
16100000    132K rw---    [ anon ]
16121000    892K -----    [ anon ]

The last one is in current use.  The others are lost.
And, yes, I'm sure it is coming from malloc because when I use
the __malloc_hook stuff to capture larger allocations, these mappings
do not happen.  However, it hangs.  I have to go back and add some
pthread syncronization primitives, too.  Maybe that's all I need do?
Were you all having syncronization issues in glibc 2.3.2?

Thanks for your help.  Regards, Bruce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]