Created
March 16, 2012 10:00
-
-
Save lynxerzhang/2049373 to your computer and use it in GitHub Desktop.
garbage collection in aswing framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //create a frame | |
| var f:JFrame = new JFrame(this); | |
| //...... | |
| //some children add in this JFrame | |
| f.show(); | |
| //...... | |
| //and final we dispose it | |
| f.closeReleased(); //this method will call it's dispose() method | |
| f = null; | |
| /* | |
| * I use flashdevelop's 'swf profiler' tool to 'check Memory' and 'live objects count' | |
| * and more instance created with JFrame is not gc. (they still in memory). | |
| * wait a moment, I use gskinner's hack method (call "new LocalConnection().connect('same name')" twice). | |
| * and found still not gc, too. | |
| * | |
| * I guess the reason is that Jfram has more parent chain, and they create more event listener, and *dispose() method do not remove these event listener. | |
| * | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment