On Wed, 16 Apr 2008, Emanuele Ricci wrote:

> I just discovered that ruby allocates memory in 8Mb chunks.
> Forgive my ignorance.
> Is there a way to change this behaviour? Since my app runs in an
> environment with very strict memory constraints, a memory spike of 8Mb
> can be lethal...
> I would change it to a lower figure.

In the Ruby source, in gc.c:

#ifndef GC_MALLOC_LIMIT
#if defined(MSDOS) || defined(__human68k__)
#define GC_MALLOC_LIMIT 200000
#else
#define GC_MALLOC_LIMIT 8000000
#endif
#endif


Start there.


Kirk Haines