[Beowulf] memory allocation on x86_64 returning huge addresses
rokrau at yahoo.com
Mon Feb 7 12:18:00 PST 2005
thanks a lot for this hint. I will try it.
Quick question: So this will let me sbrk all the available memory then?
Is there a way to tell it to allocate all available memory with mmap? I
used to hack the kernel and change TASK_UNMAPPED_BASE in the kernel in
order to get all memory from the box in one large chunk. I guess I
should have instead lowering it raised the value.
I really would like to actually find some docs about this...
--- Greg Lindahl <lindahl at pathscale.com> wrote:
> > The problem is that malloc returns an address that is way beyond
> > 8billion which is not what I had expected.
> This e-vile hack makes it produce something lower in memory. What it
> is turns off glibc's malloc algorithm's feature that has it mmap()
> malloc()s. Stuff into a .c, link the .o into your application.
> -- greg
> #include <stdio.h>
> #include <malloc.h>
> static void mem_init_hook(void);
> static void *mem_malloc_hook(size_t, const void *);
> static void *(*glibc_malloc)(size_t, const void *);
> void (*__malloc_initialize_hook)(void) = mem_init_hook;
> static void mem_init_hook(void)
> mallopt (M_MMAP_MAX, 0);
> Beowulf mailing list, Beowulf at beowulf.org
> To change your subscription (digest mode or unsubscribe) visit
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
More information about the Beowulf