File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Memory Leak. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Memory Leak." Watch "Memory Leak." New topic

Memory Leak.

Pete Dawson

Joined: Oct 27, 2009
Posts: 7

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:

Darryl Burke

Joined: May 03, 2008
Posts: 4523

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.

edit Another relevant discussion:

luck, db
There are no new questions, but there may be new answers.
I agree. Here's the link:
subject: Memory Leak.
Similar Threads
Timer starts twice when it should start only once
EJB Timer Services Query
Stuck on setVisible()
How do I refresh the system time
Timer starts twice when it should start only once