Hi Jan,

Short answer: no, because Java has no sizeof operator.

You can use Java profiling tools to examine the memory usage of your
app if needed.

Since all of clojure's data structures are persistent (reusable), they
won't necessarily meet your expectations for memory usage based on the
standard definitions of vector/list/etc.  A clojure vector is *not*
just an array.  A clojure list is *not* just a linked list.  The names
refer to the performance characteristics (vectors allow random access,
lists allow linear access) rather than the implementation.  In fact,
most of Clojure's data structures are variants of trees, and they are
quite efficient.

If you are concerned about memory usage, I recommend you write a
prototype of your app using Clojure's built-in structures first.  If
that uses too much memory, try refactoring your code to use Java
arrays or some other Java data structure optimized for your use case.

-SS



On Jul 21, 5:51 am, Jan Rychter <j...@rychter.com> wrote:
> Is there a way to get the size of a data structure in Clojure?
>
> I've been wondering how much more space-efficient vectors are than
> lists, but I don't know how to measure it.
>
> --J.
--~--~---------~--~----~------------~-------~--~----~
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