Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Shutdown Command and GC  (Read 8011 times)
pod clock
Newbie
*
Posts: 4


View Profile Email
« on: March 29, 2010, 07:29:22 »

I have a multicore project built in Flash, which loads other PureMVC multicore swfs. Before I unload a swf I run a shutdown command sequence inside the swf which removes listeners, children etc. Everything works fine but I've been reading through the gc tutorial and tracing the app's memory usage and sure enough I'm not getting the memory back when I unload a swf. I'm a bit fuzzy on if or how removeCore() might work in this case or if would help? Is there a way to force gc in this case and stay in player 9?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: March 29, 2010, 09:51:03 »

Well, as that GC tutorial notes, you can 'ask' for GC in FP9, but you don't always get it. You can't really force it at all. But we've been pretty successful in getting things unhooked.

Beyond not cleaning up your own created references, the key places that make things sticky are binding and services (in Flex/AIR at least). You need to make sure you've canceled any outstanding service calls, unhooked their listeners and nulled them. And with push channels (RTMP), I've found it's practically impossible to remove completely.

One way to test might be to instantiate the normally loaded swf from a simple top-level swf (no PureMVC or other classes involved) and then null it and call GC and see what happens. That's a start. If you can programmatically poke a pipe into it and send it a message (again, you don't need a PureMVC apparatus to do this, read through the Pipes unit tests to see how easy this is), you should be able to prod the module into doing everything it would if it were inside a larger PureMVC program. Get it to create its services, export its view components,  whatever it normally does. Then try nulling it from your top level app and see what happens.

-=Cliff>
Logged
pod clock
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: March 30, 2010, 05:47:47 »

Thanks, I had an enterFrame still running in one of my classes and stopping that helped a lot. This is the first time I've built an application that loads other multicore swfs, so I'm trying to get a grip on shutting things down. Does the player 10 unloadAndStop() method solve this problem (I'm using CS3 Flash), or would I still need to unhook everything?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: March 31, 2010, 09:58:54 »

Does the player 10 unloadAndStop() method solve this problem (I'm using CS3 Flash), or would I still need to unhook everything?
It'd be lovely if it did. Truthfully, though, I haven't had time to test / investigate it much beyond reading a few posts on it.

If you try it let us know what you find, otherwise I will eventually get around to it.

Cheers,
-=Cliff>
Logged
Pages: [1]
Print