[gambit-list] Space leak or bad gc parameters?

Denis Fourt denis.prog at hotmail.com
Sat May 16 17:21:46 EDT 2015


Hi,
This week, I have implemented streams as described in SICP in Erlang. I have used Eratosthenes's sieve as a test case, as described in SICP. I already had the same algorithm in scheme.
My implementation of force and delay in Erlang is the most basic using a thunk as a promise (memoization is rather difficult to implement in Erlang, which means that, for example, SICP implicit stream definition of the Fibonacci sequence is rather inefficient).
On the other hand, Erlang controls much better the heap with the sieve than gsi and asking for the 100 000th prime number is just a matter of time. Gambit gsi heap grows so fast that the algorithm is just useful for teaching.
I wondered if this difference was related to the delay/force implementation and to the place of the call to cdr (that is delayed or not). I rewrote the streams algorithms in scheme so they were as closed as possible to Erlang.
On gsi, this has not lead to any improvement. Setting a maximum heap size has only resulted in raising an exception.On Scheme48, the sieve runs like in Erlang though slower. Erlang alike algorithms are nevertheless much much faster (about three times for the sieve).
I believe Scheme48 and Erlang use the same kind of garbage collector... So is there a way to better to tune Gambit garbage collector or is this a garbage collector algorithm problem? 
Thanks,
DenisPs http://mitpress.mit.edu/sicp/full-text/book/book.html


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150516/c886ae08/attachment.htm>


More information about the Gambit-list mailing list