[gambit-list] Problem with heap-size

Marc Feeley feeley at iro.umontreal.ca
Thu Aug 14 09:51:07 EDT 2008


You are probably using a 32 bit processor.  Gambit represents Scheme  
objects with a 32 bit header containing 3 bits for the GC, 5 bits for  
the type information, and 24 bits for the length of the object in  
bytes (max object size = 16MB).  Gambit tables are objects which  
consume 8 bytes per entry (including inactive entries).  So on a 32  
bit processor, tables are limited to 2*10^6 entries.  Your second call  
to doit tries to create a table with (at least) 10*10^6 entries, which  
is impossible.

The error message is perhaps a bit confusing...  I'll see if this can  
be improved.  Others have been similarly confused.  I'm thinking of  
redesigning Gambit's memory allocator (mainly to have a better GC) so  
I may remove this limitation in the process.

Solution for now?  Get a machine with a 64 bit processor (the 64 bit  
header will have 56 bits for the object length, which should be  
sufficient!).

Marc

On 14-Aug-08, at 9:11 AM, Hans Petter Egesund wrote:

> Hi, thanks for open-sourcing such a cool Scheme!
>
> I am testing out how to make a large table, but have problems with
> heap-size:
>
> (define t (make-table))
>
> (define (doit x x-max)
>    (if (<= x x-max)
>       (begin
>          (table-set! t (number->string x) x)
>          (doit (+ x 1) x-max))))
>
>
> (doit 1 1000000) works fine and is fast as well.
> (doit 1 10000000) runs out of heap-space, which is probably not that
> strange.
>
> I try to increase the heap, but still can't store any more records (I
> start gsi with parameter gsi -m:3000000 and/or gsi -h:3000000).
>
> I have also compiled the program with gsc, and started the program
> with a larger heap, but the problem remains. If I try to allocate to
> much memory (like 5 GB on my 4 GB machine), the programs gives me an
> error msg, so it seems the heap is actually allocated?
>
> Any clues?
>
> Cheers,
>
> Petter Egesund
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list