
On 1/11/06, Christian Maeder
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)? Hi
Following compiles and runs for me (ghc 6.4.1), but I didn't test any effects. C-bits: #include "Rts.h" #include "RtsFlags.h" void SetMinAllocArea(int a) { RtsFlags.GcFlags.minAllocAreaSize=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 HTH, Esa