Thanx for ur response,
Actually We are using string builder in our project, String Builder
causing the memory leak in as I google, Thats the main reason i want
to set the StringBuilder object to nil,
We are using the htmlunit core js library for fetching the web pages
which require the javascript enabled. The Decompiler.java using a
variable StringBuilder result = new  StringBuilder(); Netbeans
profiler showing that this is the object consuming maximum of memory
causing memory leak. Thats the reason only I want to set the
StringBuilder object in our project to null. I also found on net that
strbuilder.toString() also causing the memory leak. So in place of
toString() we are trying to use substring(0). As u have written that
in java term, they are final but its allowing me to set the length
after declaration. like:

(defn #^String element-text
  ([thing]
     (let [delimiter #s""]
       (element-text thing delimiter)
       ))
  ([thing #^String delimiter]
     (if (instance? Node thing)
       (node-text thing)
       (let [buf (StringBuilder.)]
         (doseq [#^Node e thing]
           (node-text e buf delimiter))
         (let [res (.substring buf 0)]
           (.setLength buf 0)
           res)))))
If I am wrong, Then pls suggest me right way to do this thing.
Thanx again for ur response

Regards
Manish Zedwal
On Jan 12, 2:15 pm, Mike Hinchey <hinche...@gmail.com> wrote:
> One of the big features of Clojure is you can't changes variables after they
> are initialized - in java terms, they are all final.  However, when the let
> exits, the buffer variable is out of scope, so the StringBuilder object can
> be gc'd if that's what you're concerned about.  Inside the let, you can have
> another let, with a variable even with the same name, but it's really a
> different variable and only active within that inner scope.  Note, = is a
> function that tests equality, like == or .equals() in java, it's not
> assignment.  If you explain more about what you want to do, someone might be
> able to offer more advice.
>
> -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