Skip to content

Instantly share code, notes, and snippets.

@lynxerzhang
Created March 16, 2012 10:00
Show Gist options
  • Select an option

  • Save lynxerzhang/2049373 to your computer and use it in GitHub Desktop.

Select an option

Save lynxerzhang/2049373 to your computer and use it in GitHub Desktop.
garbage collection in aswing framework
//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