storing highly shared data structures

Esa Ilari Vuokko eivuokko at
Wed Jan 11 08:43:08 EST 2006

On 1/11/06, Christian Maeder <maeder at> wrote:
> Simon Marlow wrote:
> > You can change the allocation area size from within a program quite
> > easily.  Write a little C function to assign to
> > RtsFlags.GcFlags.minAllocAreaSize (#include "RtsFlags.h" first), and
> > call it from Haskell; the next time GC runs it will allocate the larger
> > nursery.  Please try this and let me know if it works.
> Can someone supply a code snippet for me (as I don't speak C and always
> hoped to avoid C by using haskell)?

Following compiles and runs for me (ghc 6.4.1), but I didn't test any effects.

#include "Rts.h"
#include "RtsFlags.h"
void SetMinAllocArea(int a) {

Haskell bits:
import Foreign.C.Types
foreign import ccall "SetMinAllocArea" setMinAllocArea :: CInt -> IO ()

It requires compiling c-bits without --make, something like
ghc -c bits.c -o bits.o
and including it on final linking or --make step (or ar/ld, similary)
ghc bits.o --make main


More information about the Glasgow-haskell-users mailing list