You are effectively setting buf to null, that is implicit in a let.
node-text doesn't persistently hold a reference to the buf does it?

In a quick search, I see that StringBuilder will share the char[] with
Strings from it's toString.  I don't know if substring also shares, it may.
Since you're releasing the reference to buf, it's not clear to me what
(.setLength buf 0) will do, it's all available for GC anyway.  You might
want to open up the code for StringBuilder.

If SB is sharing the char[] with the String from toString or substring, it's
possible the char[] is much bigger than it needs to be.  As you're appending
to SB, it will grow the array speculatively, 2x I think, so it doesn't have
to grow (and copy) with every append.  If it then shares this array with the
String, that String will hold onto an array 2x bigger than it needs.  I've
heard it recommend to create a new string out of the old one, so the old one
can be GC'd even though this is an extra copy.  I haven't researched this,
but I hope this helps.

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