On Dec 23, 4:51 am, Robert McIntyre <r...@mit.edu> wrote:
> I think it would be really cool to have a function that gives the
> total number of bytes that a data structure consumes.
>
> so something like:
>
> (total-memory [1 2 [1 2]])
>
> would return however many bytes this structure is.
>
> Is there already something like this around? Would it be hard to write
> to work for any clojure data structure?
>
> just like (time), I think (total-memory) would be very enlightening
> for basic testing.
>
> sincerely,
>
> --Robert McIntyre

I've used the Instrumentation debugging interface to find the size of
an object in the past:

    http://www.javamex.com/tutorials/memory/instrumentation.shtml

You'd need to walk the object tree and sum up the results avoiding
cycles.

many thanks,

- Dale Thatcher

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to