Results 1 to 3 of 3
  1. #1
    MartinR is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default ActionListeners linger on after closing the internal frame

    Hi,

    I am working on a relatively large Java software package which implements GUI and various algorithms to perform computations in imaging related research. This package uses internal frames. There is a problem in that the memory size keeps growing when a internal frame is opened and closed by the user. The internal frame has menus. These menus have components which register various action listeners. The problem is that, after the internal frame is closed, certain types of action listeners linger on, leading to an increase in the memory size. These action listeners implement the Action class (abstract action). Effectively here is the inheritance chain:

    Action<-AbstractAction<-TAction.

    It is the TAction which is instantiated in a menu class. In the memory profiler, the lives instances of TACtion remains after the internal frame is closed. I have been trying various options to track down the listeners and remove them and have failed. Any general or specific advice as to how to go about solving this problem is appreciated. I am fairly new to Java, but have been programming for long time. Thank you.
    Regards,
    Martin

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    take a look at weak references

  3. #3
    MartinR is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    Thanks. I tried WeakHashMap to set weak references to the listeners, hoping that gc will collect these objects afar the components that have registered them are removed. But, that doesn't seem to be the problem. Does this suggest that there may be system level hard references to this listeners? Any suggestions as to how to proceed from here is much appreciated.
    Regards,
    Martin

Similar Threads

  1. Question about ActionListeners and JAR files
    By Psyclone in forum AWT / Swing
    Replies: 6
    Last Post: 03-20-2010, 12:08 PM
  2. Replies: 7
    Last Post: 11-02-2009, 06:31 PM
  3. Replies: 1
    Last Post: 12-07-2008, 05:50 PM
  4. Getting internal frame out
    By rad in forum New To Java
    Replies: 8
    Last Post: 08-11-2008, 02:33 AM
  5. Internal Frame order and canvas Z Index
    By dazza-s in forum New To Java
    Replies: 3
    Last Post: 05-29-2008, 06:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •