From beowulf Mon Feb 07 20:18:00 2005 From: Roland Krause Date: Mon, 07 Feb 2005 20:18:00 +0000 To: beowulf Subject: Re: [Beowulf] memory allocation on x86_64 returning huge addresses Message-Id: <20050207201800.97502.qmail () web52909 ! mail ! yahoo ! com> X-MARC-Message: https://marc.info/?l=beowulf&m=110781092200040 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 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 > #include > > 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