Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Some kind of slow leak?

Thread view: 
Twisted - 24 Feb 2006 04:39 GMT
I have a Java app I'm developing here that seems to have developed a
slow leak.

It spawns around 100 threads, which do various things with some shared
resources (mainly collections); the resources are locked (in a fixed
order) before use, so this shouldn't be a concurrency issue. These
collections are periodically either wiped or halved in size, when they
grow to certain sizes, so that they cannot cause the memory use of the
app to grow without bound.

Yet grow it does; the task eventually bloats up to 90+ meg and when it
gets to that size, it becomes slow and unstable. Then I start getting
crashes. Best case, weird exceptions or OutOfMemoryErrors (when there's
still 3/4 of the machine's physical RAM free!) pop up and it tries to
exit gracefully. Or it lurches to a halt (hangs, possibly taking the
IDE down with it if its debugger is attached to the process), or it
outright crashes (sigsegv in Hotspot VM).

Anyone have an idea what's happening here? Lots of objects are created
transiently and discarded -- is it possible the system GC isn't able to
keep up with the rate at which this occurs? (Translation: use less
threads, even if it means the app spends more time idling and less
accomplishing something useful.) Or is there a way that things might be
hanging around, and cruft slowly accumulating in memory that isn't
getting swept away? (Possibly a library call that uses a native method?
Native methods written in C could leak easily, unlike Java code.) Or
perhaps attaching a debugger is itself causing the bloat? (Objects the
debugger notices may hang around because the debugger hangs onto
references, which stop them being gc'd?)

JDK and JRE version 1.5.0_06.
josh.s17@gmail.com - 24 Feb 2006 10:56 GMT
Have you tried increasing the heap size of the JVM. Just because you
have available memory on the machine doesn't mean it will automatically
be available to your process.
Twisted - 24 Feb 2006 19:05 GMT
??

Anyway, I'd prefer to actually fix its mem use not to be so excessive.
Nothing it does requires even 90-odd megs...
josh.s17@gmail.com - 25 Feb 2006 00:13 GMT
Perhaps someone who suggest a profiling tool to use? Without looking
thought source it is hard to offer any other suggestions.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.