Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory Leak.

 
Pete Dawson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've been experimenting with using two instances of a frame in a Swing Application framework application. I'm trying to use a util.Timer to create a frame then hide it, null the reference and recreate another instance.

When I leave this running I eventually run out of heap?? Can anyone explain why as I think that I am only ever using one one reference to an object on the heap.

TimerTestView is just the plain default view created by the framework.

I have put the timer code in the startup() method as follows:



Thanks
Pete
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MAy or may not be the root cause, but all Swing components should be constructed and mutated on the EDT. There's at least one recorded case where failure to do so resulted in OOME.
http://forums.sun.com/thread.jspa?threadID=5406558

edit Another relevant discussion:
http://forums.sun.com/thread.jspa?threadID=5279223
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic