[plt-scheme] sizeof

From: David Brown (plt at davidb.org)
Date: Tue Jan 5 18:46:40 EST 2010

On Tue, Jan 05, 2010 at 02:39:15PM -0800, Synx wrote:

>(sizeof (make-thingy (current-custodian) (current-continuation-marks)
>(current-eventspace)) => ?

Some of these things also cause allocations, so you're measuring a lot
more than just the size of thingy.  Using (current-custodian)
(current-input-port) and (current-output-port) gives me a more sane
answer of 80 bytes.

This is also measuring the overhead of a cons cell as well.  If I put
a constant as each element of the list, I get slightly less than 32
bytes for each cons cell, which seems about right for a 64-bit
platform.

David


Posted on the users mailing list.