More than one JFrame and disposing them - memory leaks...

Hi,
I'm opening more than one JFrame from my application. The main JFrame is a standard one and each new one is a little bit different:
class MyFrame extends JFrame {
  public MyFrame() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    new MyThread().start();
  private class MyThread extends Thread {
    public void run() {
}The problem is the when I use this inner thread and then close the frame, no resources are freed (of course I am sure this inner thread is no longer running and then I close the frame). Each resource is stored only locally.
I tried to add the finalize() method, run time to time System.gc() and System.runFinalization() from the main thread and that is what I observed:
- the finalize() of the MyThread class sometimes is invoked,
- the finalize() of the MyFrame class is never invoked.
When I throw away running this inner thread - finalize() of MyFrame is invoked.
Is there any general rule for creating such multithreaded solutions with swing components which I don't know? Or there must be something weird in my implementation of MyThread? One more info - when closing JFrame isAlive() of MyThread returns false (I have tested it using window listener).
milt

Since your inner class is non-static, it maintains an implicit reference to
the enclosing class. That would keep it from getting collected while the
thread is running. Unless closing the Frame forces the thread to
stop somehow, the thread will keep running to completion.
finalize() is not a reliable source of data, sadly.

Similar Messages

  • TS4436 How do I select more than one picture and send them all to Facebook on my iPhone 4s with iso7?

    How do I select more than one picture and send them all to Facebook on my iPhone 4s with iso7?

    Hi, I want to thank you for all your information regarding my questions about sending more than one photo to Facebook. I did have to stop in at Verizon (where I bought my iPhone) to find out why I did not have a choice to choose Facebook with the export icon. The tech had to go into my setting and enable Facebook to recognize my iPhone. When I upgraded to iso7 somehow it could not recognize Facebook. Once he did this for me I was able to follow your advice and your answer solved my question. Thank you

  • Can't I get my old iTunes that I have purchased downloaded from Apple?  I don't have the old computer anymore.  Also, is there a number to call if I think I have more than one account and would like them to consolidate my accounts?

    I have two problems:
    1.  I no longer have my old computer and want to download the iTunes I have purchased in previous years.  Aren't they all in "the cloud?"
    2.  I think I have more than one account and would like to get them combined.  Is there a good number or email to Apple that I could get that done?
    THanks!
          SHawn

    It has always been very basic to always maintain a backup copy of your computer.  Have you failed to do this?
    You can redownload some iTunes purchases in some countries:
    Download past purchases - Apple Support
    As provided, you cannot merge accounts
    Sorry

  • Can I update more than one iPad and iPhone from the same MacBook pro?

    Can I update more than one iPad and iPhone to ios 5 from the same MacBook pro? Our family has one MacBook pro and several iphones and ipads.  No one wants to lose their iTunes music or contact list or calendars.

    Yes, but you will want to think it through before you do it.
    The computer will become the "master" device, holding the definitive collection of music, photos, contacts, etc., and each iPad or iPhone will get a copy of what's on the computer. So if  everyone has different collections of music or photos that you all want to keep separate from each other, you'll want to set up different accounts on the MacBook Pro. To do that, go into "System Preferences" and click "Users", then click the "+" to create a new account for each person who needs their own set of files.
    That way you can each log in to your own MacBook account before you sync your iPhone or iPad, and everyone has their own copy of iTunes and their own iPhoto. If you happen to plug in an iPhone while logged into someone else's account, you just click "don't sync" (the 1st time only, it will remember after that). Sharing the same files becomes tricky, so this is only the best method if you want to keep things 100% separate.
    On the other hand, if you all have your music and photos mishmashed together on the MacBook anyway or just don't care about keeping things separate, just go ahead and sync your iPhones and iPads without setting up new accounts. But in this case, you should create playlists and photo albums in iTunes and iPhoto. Then plug in an iPhone, click on it's icon in iTunes, and change the settings for Music, Photos, etc to only sync the playlists that you want on that device. Repeat for each one. They'll all remember their own settings, and continue to sync with their designated playlists or albums.
    What you cannot do is use more than one computer with a single iPhone. That will wipe out the music and photos that were on it already, replacing them with the ones on the second computer.

  • By subscribing to Creative Cloud(Photoshop and Lightroom), does it come with more than one license, and is it possible to install it on both Windows and Apple(if it comes with two licenses)? Thank you.

    By subscribing to Creative Cloud(Photoshop and Lightroom), does it come with more than one license, and if it does, is it possible to install on both Windows and Apple's OX? Thanks.

    A Cloud subscription provides for installing working installations on two machines.  You can have mixed operating systems (both Windows and Apple's OX).

  • How can I use more than one iphone and keep contacts separate?

    How can I set up more than one phone and keep our contacts and messaging separate?

    Use separate Apple IDs for iCloud on each phone.

  • Adding music to more than one slide and not the entire presentation

    I love the way Keynote looks and behaves, but it fails to compete with PPT on certain aspects, such as adding the same audio track to more than one slide and NOT have it play for the entire presentation. Using PPT (and I hate PCs!) you can have a track play for "n" number of slides. I'm frustrated that I cannot do this with Keynote! I don't want the track as a soundtrack for the entire presentation. I want to add another audio track to, say, the last two or three slides only and something else for all the other slides. I looked through the user manual, forums, etc. and found that I can only add a soundtrack to the entire thing or a different audio to only one slide.
    Question: What if I cut (that last two slides) and paste the the slides as a new Presentation with its own soundtrack, then reincorporate that back and paste it into the original presentation? Will that work or will the original soundtrack take over the entire presentation again?

    Anyone remember Claris Works for Mac back in the early 90s? Now, that was a gem! What were they thinking when they got rid of that one (and replaced it with AppleWorks!)?
    Good point, but one which Apple has heard a zillion times, and so sadly chosen to ignore. The really heartbroken among us remember AppleWorks from the mid-'80's, the world's first integrated suite, then ClarisWorks, then AppleWorks; and, of course, Beagle Bros. and BeagleWorks. But since we old f*s are dying off, those complaints will eventually stop. +Sic transit gloria mundi.+

  • Posting topic to more than one thread and in different categories...

    Is there anything in the TOU we can "refer" to when users post the same topic in more than one thread and to add to that, more then one category? Case in point: http://discussions.apple.com/thread.jspa?messageID=8806009#8806009 (This is just one example)
    Limnos had a valid point. If we had a section in the TOU we could copy/paste from, I think it would help if we could refer to authority, ie., TOU.
    Thanks!
    Carolyn

    I wouldn't get into too much of a flury about that with end users. Notify as needed and let the moderators decide if it needs to be deleted. A good rule of thumb is you want the discussions to have:
    Everyone should feel comfortable reading Submissions and participating in discussions.
    That's from Terms of Use.
    And then there is:
    You agree to not interfere with or disrupt the Site.
    I'm seeing that logically one can conclude directing users not to crosspost may be considering interference with the site. I may suggest someone post in another forum if a solution is not transparent in the forum they are using, but that's as far as I'm comfortable bending the rules.
    I'm trying hard to keep my thumbs away from the keyboard when I see duplicate posts.

  • Simultaneously read more than one input and generate output

    Is it possible To simultaneously read more than one input and generate outputs depending on these inputs? If this isn't possible what is the best way to go about making some sort of timed loop that will read an input, read the next input, decide whether or not to output and so on. Hope someone can help. Thanks.Message Edited by Esmith13 on 05-25-2005 01:36 PM

    Hi,
    You should look at the synchronized examples for analog input and output that can be found in the example finder under:
    Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Synchronization>>Multi-Function
    These will get you started to being able to handle multiple tasks at the same time.
    I hope this helps. Have a Great Day!
    George

  • I entered calculates hands and more than one account and used a credit card please raise security measure for Visa card and thank you

    I entered calculates hands and more than one account and used a credit card please raise security measure for Visa card and thank you

    Hi Eva B.,
    Please refer to the help document below:
    Adobe Store | Online order and payment FAQ
    Regards,
    Sheena

  • Can't add a goods-issue with more than one item and one is serial managed.

    Hi,
    We are trying to issue more than one item to a production order using the DI API.  If none of the items is serial managed, they all are accepted and the goods-issue Add is successful.  If one the items is batch-managed, the goods-issue Add is also successful.  I am able to add the goods-receipt if I it contains only one item and it is serial-number managed.  However, if I’m issuing more than one item and one or more of the items is serial number managed, then the DI API will not add the goods-issue.  The error message that appears refers to an item that is not among the items being issued.  The message is:
    -10: (IGE1.WhsCode)(line: 3), ‘Item ‘A00006        ‘ with system serial 1 is not in stock.’
    Again item A00006 is not even in the group of items being issued.
    The code I am using for the serial number part is:
    With oGoodsIssue.Lines.SerialNumbers
              .SystemSerialNumber = rs.Fields.Item("SysSerial").Value
              .ManufacturerSerialNumber = rs.Fields.Item("MfrSN").Value
              .InternalSerialNumber = rs.Fields.Item("IntrSerial").Value
              .SetCurrentLine(n)
              .Add()
              rs.MoveNext()
              n += 1
    End With
    The rs is a recordset that the code is looping through as the serial numbers are being added.
    The error message does not occur during this code.  It occurs when it tries to add the full goods-receipt.  Does anyone have any idea how I can fix this?
    Thanks,
    Mike
    Edited by: Mike Angelastro on Mar 31, 2008 8:43 AM

    Hi Mike,
    Try to do the ".Add" only if you need it. Doing a ".add" without assignation may cause the error you have.
    I guess your n variable start at 1 or 0, so you could put code like this :
    With oGoodsIssue.Lines.SerialNumbers
    if n = 0 then (or 1, also I don't the correct syntax of your programming language)
    .Add()
    end if
    .SystemSerialNumber = rs.Fields.Item("SysSerial").Value
    .ManufacturerSerialNumber = rs.Fields.Item("MfrSN").Value
    .InternalSerialNumber = rs.Fields.Item("IntrSerial").Value
    .SetCurrentLine(n)
    rs.MoveNext()
    n += 1
    End With
    HTH
    Jodérick

  • I downloaded Adobe Acrobat X in 2010 and then a few years later I got a new computer and I would like to install the Adobe Acrobat X on my new computer but I cannot tell if I had more than one license and my Adobe account is not showing that I ever downlo

    I downloaded Adobe Acrobat X in 2010 and then a few years later I got a new computer and I would like to install the Adobe Acrobat X on my new computer but I cannot tell if I had more than one license and my Adobe account is not showing that I ever downloaded or ordered anything.  Can you assist?

    Download/install it from http://helpx.adobe.com/acrobat/kb/acrobat-downloads.html and activate it with your serial number.

  • How long does it take for the IOS 7.1 to finish updating? My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    My phone has been plugged in to my computer for more than one hour and the status bar only shows about less than 1/4 completed. I have an iphone 5s btw.

    Depends on how strong your wifi connection is.
    you can try a reset hold down the home/sleep button together until you see the apple logo and then release.

  • Firefox will not open more than one window and upon restarting will not open the previous tab and refuses to open bookmarks

    Firefox does not open more than one window. I can open plenty of tabs, but not more than one window. Upon closing firefox and trying to restart the browser will not open and needs to be closed through windows task manager. Upon trying to re-open Firefox I receive the 'oops this is embarassing , firefox cannot re-open your tabs" message. When I click on "new session" the bookmarks do not load. It is becoming very frustrating as I am a student and often do lots of research on the web while using lots of open windows.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    See also "Hang at exit":
    * http://kb.mozillazine.org/Firefox_hangs
    * [[Firefox hangs]]

  • Use more than one look and feel in the Portal

    Hi,
    I'm searching for a solution to use more than one Theme in the portal. It's not based on user or a role. One and the same user should be able to enter the portal and depending on his adress he should be rooted to A or B theme.
    We are usein EP6 sps13.
    Kind regards
    Michiel Veenemans

    Hello,
    To my feeling you should be work with display rules.
    You probably have user who need one theme and other user you want to give another theme. By using display rules you can assign a theme to one user group and another theme or themes to another group.
    So depending on the group the user is assigned to you get another theme. This way everybody uses the same URL and a theme can be altered with the default user functions.
    Best regards,
    Frederik

Maybe you are looking for

  • Trying to re-link files after a PC crash :( I get an error saying audio file has 1 channel original

    The exact error reads: "The selected file cannot be linked because it has 1 audio channel(s) and the clip was created with 2 audio channels" Now, the project was created with the video file I am linking to, not a different one, the same one, but it a

  • Widescreen monitor support?

    I was recently gifted with a Dell 20" widescreen monitor that I'd like to use with my G4 running 10.2.8. I can't figure out how to create a monitor setting that will pixelate properly. Any ideas/help? This is my spare graphics machine, so if the moni

  • How do you have two classes drawing to the same JPanel? Graphics g problem

    Hi all, This is probably a five second answer but im really stuck on it! How do i have two classes both writing to the same JPanel? I have one class that extends JPanel and using Graphics g, draws to the panel ie g.drawString(..); But i would like an

  • Data Loadong Issue

    Hi, When i am loading data fron One ODS to another ODS it is giving error            'The requested object is locked by another transaction'. I checked in SM12 and RS12 there is no lock objects. Please provide the solution. Regards, vijay

  • ADS Installation - Is it part of CE Sneak Preview?

    Hello, I have just installed the CE (full version). When i look at the SCA's deployed on the server i find that ADS is not installed as part of the installation. Is this correct. Will this be provided at a later stage. Please do let us know. Regards