If there is a better place to report things like this, let me know.

I've done some looking at how much memory various kinds of Clojure
data structures use, and come across some behavior that I think might
be a memory leak, in the sense that perhaps a reference to a
java.util.concurrent.atomic.AtomicReference object is being held onto
after a call to vec, even though it isn't needed any more.

It might still be needed for reasons that I'm not aware of.  I don't
know the implementation well enough to say.

Steps to reproduce the behavior (should work on at least OS X and
Linux -- tested on OS X with java 1.6.0_13, and latest clojure and
clojure-contrib from github):

Get these two files:

clj-run.sh
memuse.clj

You can either pull my whole clojure-benchmarks git repo (only a few
megabytes), or just get those two files here:

http://github.com/jafingerhut/clojure-benchmarks/tree/450da3b949550087e6b97333ba065c1fc875564a/memuse

Edit clj-run.sh to set the location of your Clojure jar files.  Then
run:

./clj-run.sh 500000 5 1

When it prints "Done.  Going to sleep now.  Good night." then either
put that process in the background, or in a separate shell window,
find out the process ID of the java process created above, and run:

jmap -histo:live <process_id>  > jmap.txt

My belief is that the ":live" part means that only live objects with
references to them, that cannot be garbage collected, will be reported
in the output.  I've confirmed on my system that if I use "-histo"
instead of "histo:live" that I get a lot more objects reported, which
are presumably garbage.

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

I think that this AtomicReference object is fairly new in the Clojure
Java source code, with the addition of transients.  It used to be an
AtomicBoolean before that.

Would it be correct to nullify the reference to the persistent object
returned by a call to persistent! on a transient object?

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