[plt-scheme] bytes 'n bits 'n pieces

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Thu Apr 30 16:29:05 EDT 2009


While explaining TCO to students, I showed them (based on Matthias'  
ECOOP talk actually) that a simple tail-recursive OO program to  
compute the length of a list falls off very early in Java because of  
stack overflow.

While showing how the same program in Scheme works fine (either with  
lists or with actual objects), I was tempted to try with bigger sizes  
of the list, and obviously, I came across the memory size limit of PLT  
Scheme, not due to recursion, but simply due to the building of the  

To understand better, I'd like to know:
. what is the actual size of an allocated object? (empty objects with  
either no fields or a single next object reference)
. since I also want to be able to evaluate how much memory a given  
list will occupy, how much does a cons cell use?

I noticed that even with 768MB I can't create a list (in a tail  
recursive manner of course) of 100,000,000 elements (element = null).  
Rather than pursuing my trial and error approach, it would be useful  
to have the actual data...


-- Éric

Posted on the users mailing list.