It's almost never a good idea to use finalize. Basically, you should only use finalize when you're holding native resources that need to be released when your object is GC'd.
If you're using finalizers just to investigate when certain objects are getting collected, you might want to use WeakReference and ReferenceQueue for that instead. On Sun, Jul 28, 2013 at 9:32 PM, Brandon Bloom <brandon.d.bl...@gmail.com>wrote: > Hi all, > > I'm trying to understand the object retention behavior when subseq is > applied to sorted collections. > > A quick glance at the source of > APersistentTreeMap.java<https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentTreeMap.java> > suggests > that the reified subseq only contains pointers to nodes to the left or > right of the initial value node. Assuming I'm reading correctly, that means > subseq should never retain unaccessible nodes in the original sorted map or > set. > > Here's an experiment that seems to back that up: > https://gist.github.com/brandonbloom/6101597 > > This produces a few questions: > > 1. Is my experiment good? > 2. What is the cause of the "double" finalizations? It seems like > every object has an initial speculative finalize fail on it... Why? > 3. Am I correct in saying that subseq will never retain extra objects > from the original tree? > > Thanks, > Brandon > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.