• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Memory Leaks  RSS feed

 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have a huge program that after 4 hours or so of executing, crashes because of an 'out of memory' error.
I have downloaded jprobe and optimizeit, but do not know how to fully utilize the information from these windows. Anybody else use these programs before?
Anybody have any suggestions on how to fix a memory leak?
Thanks
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For OptimizeIt
1) Run the program in OptimizeIt
2) Shortly after it's in a stable state (i.e. after startup finishes), mark the memory
3) Come back a few hours later and see the difference in memory from the mark. This should give you an indication of what object in particular are being built up.
From there you can track, either on your own or using OptimizeIt where exactly those objects get created.
--Mark
 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, the object with the biggest difference was java.lang.ref.finalizer.
Are you familiar with this?
 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
actually I did that and the object with the most memory was the
java.lang.ref.finalizer
 
pavitra jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Theoretical information, since I do not have access to profiling information.
1) Adding a finalizer method extends the life of the object, since it cannot be collected until the finalize() method is run.
2) finalize thread runs on lower priority than garbage collector. also there is no guarantee when it will run.
3) And the one common problem that occurs is that objects can be ressurected by another referrer even after being put on the finalizer queue.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!