[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: Greg Lindahl <lindahl () pathscale ! com>
Date: 2005-02-07 18:41:08
Message-ID: 20050207184108.GA1364 () greglaptop ! internal ! keyresearch ! com
[Download RAW message or body]
> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic