[plt-scheme] sizeof

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Jan 5 11:23:50 EST 2010

It doesn't look like it, but I may be doing something wrong (the
printf is just there to be usre that the object is still in used).

(let ([c (make-custodian)])
    (parameterize ([current-custodian c])
      (let ([obj (cons 1 2)])
        (collect-garbage)
        (begin0
          (current-memory-use c)
          (printf "~s\n" obj)))))

This produces 0 for me.

Robby

On Tue, Jan 5, 2010 at 10:18 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> Could you create it in a new custodian and measure that custodian memory usage?
>
> Jay
>
> On Tue, Jan 5, 2010 at 8:00 AM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> You can create a bunch of them and compare the amount of memory used
>> before and afterwards (and divide).
>>
>> Robby
>>
>> On Tue, Jan 5, 2010 at 8:53 AM, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
>>> Hi all,
>>>
>>> Is there a simple way of estimating the number of bytes of RAM that a particular piece of data is occupying?
>>>
>>> e.g.
>>>
>>>    (sizeof some-large-data-structure) ; ==> 1024 bytes
>>>
>>> I saw the sizeof package on PLaneT but it looks like that's for FFI structures, not scheme ones.
>>>
>>> Many thanks,
>>>
>>> -- Dave
>>>
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>
>
>
> --
> Jay McCarthy <jay at cs.byu.edu>
> Assistant Professor / Brigham Young University
> http://teammccarthy.org/jay
>
> "The glory of God is Intelligence" - D&C 93
>


Posted on the users mailing list.