[Beowulf] memory allocation on x86_64 returning huge addresses

Roland Krause rokrau at yahoo.com
Mon Feb 7 15:18:00 EST 2005


Greg,
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...

Again thanks!
Roland

--- 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
> does
> is turns off glibc's malloc algorithm's feature that has it mmap()
> large
> 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
> http://www.beowulf.org/mailman/listinfo/beowulf
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list