Archives


- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

[Beowulf] memory allocation on x86_64 returning huge addresses

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

Greg Lindahl lindahl at pathscale.com
Mon Feb 7 10:41:08 PST 2005


> 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);
}



More information about the Beowulf mailing list