Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 07-31-2007, 08:56 PM   #1
BillyRay
Registered User
 
Join Date: Jul 2007
Posts: 4
Default Class definition memory never released ?

Hi all.

Investigations on a previous matter in another thread made me think also of this potential memory annoyance.

When a class is defined in Actionscript, using 'class' definitions attached to movieclips, that class definition is created and referenced from _global by the class name:

class foo
{
public function foo()
{
trace( "FOO!" );
}
public function stuff()
{
...
}
}

ends up with

_global.foo --- references ---> [Function (foo constructor)] -- "prototype" --> references [Object] -- "stuff" --> references [Function (foo stuff)]

When a movieclip is placed with this class associated, it will essentially be able to 'New' an object with foo's prototype as it's own __proto__

When the swf file defining this class is unloaded, however, the class definition still exists on global. After performing some tests I found I could delete this reference and the class definition would be released from memory if there were no outstanding references to it.

So my thought is : for a given swf that loads/unloads lots of potentially varied classes, the memory footprint of class definitions will never decrease (unless references are explicitly removed - which has it's own problems). I would have thought for a large application with a decent lifetime that this could potentially be a problem, especially on low footprint mobile architectures?

Does anybody know of a sane way of mitigating this ? Does Flash provide any functionality to perform cleanup of stale class defs ?

Bit of a kooky one, but I'm interested

Thanks !
Will.
BillyRay is offline   Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I target a _root variable from another class? Munkey ActionScript 2.0 6 07-06-2007 03:14 PM
getting a class instantiated inside a document class.. slalonde44 ActionScript 3.0 5 05-31-2007 09:33 AM
Component Definition - AS2.0 Class Name summitSW JSFL - Extending Flash 1 03-20-2007 06:53 AM
Possible to dispatch event within a class? FarFeTTu ActionScript 2.0 5 04-29-2006 11:09 AM
Where to place a LoadVars.onLoad handler in a class definition? lowBoy ActionScript 2.0 2 11-28-2004 12:23 AM


All times are GMT. The time now is 10:34 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.