• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Java Memory Leaks

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
actually I did that and the object with the most memory was the
java.lang.ref.finalizer
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic