On Aug 15, 5:44 am, Christophe Grand <christo...@cgrand.net> wrote:
> I wouldn't call this a memory leak: vectors have a bigger memory overhead
> than before (additional PersistentVector$Node and AtomicReference).
>
> On Sat, Aug 15, 2009 at 2:13 AM, Andy Fingerhut <
>
> andy_finger...@alum.wustl.edu> wrote:
> > When I did this, one of the first several lines of output included a
> > little more than 1 AtomicReference object per calls to vec.
>
> >  num     #instances         #bytes  class name
> > ----------------------------------------------
> >   6:        500022       12000528
> > java.util.concurrent.atomic.AtomicReference
>
> > Would it be correct to nullify the reference to the persistent object
> > returned by a call to persistent! on a transient object?
>
> For a single persistent object (built with transients) there are potentially
> several references to the same AtomicReference. I think that you can't
> nullify all references and have persistent! still be O(1).
>
> One AtomicRefrence is created for each pair of transient/persistent! calls
> and, in worst case, you can't have more than one AtomicReference per
> PersistentVector$Node. So, for a given vector it won't grow indefinitely.
>
> OTH,
>
> Christophe

Understood.

Not to say this ought to be done, but would it be possible to have no
'edit' field *at all* for persistent data structures (not even a null
reference), and only an edit field at the "root" data structure of a
transient (none of the children would have one, only the root), and
preserve O(1) transient/persistent! calls?

Even if that is possible, I guess the down side is two versions of all
the data structures for transients, one with edit and one without.

But even if edit remains in all of them, I'm wondering whether it
could be maintained that only the root node has a non-null edit field,
while that data structure is transient.

Thanks,
Andy

--~--~---------~--~----~------------~-------~--~----~
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