Jan Wedekind <jan@wedesoft.de> skribis:
> I wonder whether there is a more performant way to allocate larger
> memory blocks (e.g. 1 MByte). "gc-malloc-pointerless" seems to be much
> slower than "malloc":
>
> user system total real
> Guile allocate memory 0.003780 0.000020 0.003800 ( 0.003810)
> C allocate memory 0.000060 0.000000 0.000060 ( 0.000070)
It isn’t fair to compare GC_malloc_pointerless with malloc. Instead, it
should be compared with interleaved malloc + free sequences.
You should find more on this topic on the home page of libgc, the GC
that Guile uses: <http://www.hboehm.info/gc/>
> Is there a way to control how often the garbage collector is run?
The file doc/README.environment in libgc describes some useful
environment variables, notably these:
GC_INITIAL_HEAP_SIZE=<bytes> - Initial heap size in bytes. May speed up
process start-up.
GC_MAXIMUM_HEAP_SIZE=<bytes> - Maximum collected heap size.
GC_MARKERS=<n> - Linux w/threads and parallel marker only. Set the number
of marker threads. This is normally set to the number of
processors. It is safer to adjust GC_MARKERS than GC_NPROCS,
since GC_MARKERS has no impact on the lock implementation.
Guile also honors the ‘GC_FREE_SPACE_DIVISOR’ environment variable. See
the comments in gc.h for the meaning of this one.
HTH,
Ludo’.