[prev in list] [next in list] [prev in thread] [next in thread] 

List:       beowulf
Subject:    Re: [Beowulf] memory allocation on x86_64 returning huge addresses
From:       Roland Krause <rokrau () yahoo ! com>
Date:       2005-02-07 20:18:00
Message-ID: 20050207201800.97502.qmail () web52909 ! mail ! yahoo ! com
[Download RAW message or body]

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@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@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@beowulf.org
To change your subscription (digest mode or unsubscribe) visit \
http://www.beowulf.org/mailman/listinfo/beowulf


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic