Memory Management - Make Flash 'play Well With Others'?

Apr 21, 2010

the Flash Virtual Machine relies on garbage collection by using reference counting and mark and sweep (for good coverage of these topics, check out Grant Skinner's article and presentation). And yes, Flash also provides the "delete" operator, which can (unfortunately only) be used to remove the properties of dynamic objects.

What I want to know is how to make it so that Flash programs don't continue to consume CPU and memory while running in the background (save loading content or communicating remotely, for example). The motivation for this question comes in part from Apple's ban on cross compiled applications (in its SDK 4) on the grounds that they do not behave as predicted with the multitasking feature central to iPhone OS 4. My intention is not only to make Flash programs that will 'pass muster' as far as multitasking in iPhone OS 4, but also to simply make better (behaving) Flash programs.

Put another way, how might a Flash application mimic the multitasking feature of iPhone OS 4? Does the Flash API provide the means for a developer to put their applications to 'sleep' while other programs run, and then to 'awaken' them just as quickly?

In our own program, we might do something as crude as detecting when the user has been idle (no mouse motion or key press) for (say) four seconds:

var idle_id:uint = setInterval(4000, pause_program);
var current_movie_clip:MovieClip;
var current_frame:uint;

[code]....

what's the best way to detect that an application should be shelved? And, more importantly, is it possible for Flash Player to detect that some of its running programs are idle, and to similarly shelve them until the user performs an action to resume them?

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Memory Management - Take Less Memory For Scrolling

Aug 2, 2007

I'm making an isometric game and I need to know which takes less memory for scrolling, making everything invisible that you can't see? Like if(!this.base.hitTest(worldHitter))this._visible = false; Or would it be better to remove the movieclips unseen and then reattach them when i should see them?

View 2 Replies

Flash - Memory Management In Flex Programs?

Nov 24, 2011

I am a flex programmer but i had nothing to do for handle manage memory in my projects. I think lack of memory management is reason for loading lag of swf file. Can any one help me to how to handle manage memory in flex/ as3 codes.

View 1 Replies

Flash :: Actionscript Memory Management - Garbage Collection

May 4, 2011

This blog (and others) state that you should set object references to null inside your dispose() methods when cleaning up objects. However, Actionscript 3 (with Flash Player 9) uses mark and sweep to clear out circular references for you. So I am wondering: is there really any reason to null out your object references?

View 2 Replies

ActionScript 3.0 :: More Memory Management Headaches

Aug 29, 2008

I previously asked about some FLV files that I was loading externally, and having trouble with memory being released. Having sort of solved this, I am having the same problem with loading external resources and then getting them to be cleared out of memory when I'm done with them. I have seen kglad mention more than once that GC in flash 9.0.124.0 is broken, but where does that leave us? I have also tried my project in FP 10, and the memory still continues to go up and up. If I load an external resource - in this case I have a class that builds a VR room with papervision - and then close it, set it's instance to null, my memory never goes down.

This is a total guess, but could it have anything to do with using Tweener in my project? Is there any way that the Tweener class could be keeping some of my objects in memory and keep them from being GC'd? I am using weak references in my listeners, setting any variable I can find to null... I can get over how frustrating this is to just see memory go up and up but find no reason. The class I am using also uses a few subclasses to build itself, but I end up with one instance of my VR on the stage. If I have set that instance to a name - myVR - and then removeChild(myVR) from the stage and set the name to null - that should do it right? Boy, this is frustrating.

View 3 Replies

ActionScript 3.0 :: Memory Management / Garbage Collection?

Nov 7, 2008

I have done a lot of searching / reading to find out how to clear my memory. But I still can't really work out how to clear the memory, it just never seems to come down. I have a few MovieClips that contain other MovieClips with pngs inside them being added to the stage.

As fare as I can tell all Event listeners are removed and refrences I remove the clip, with removeChild I "null" the variable I am using the "LocalConnection()" hack to try and force a clean up, but no movement on the memory count. Are there any examples of a *.png being added and removed from the memory?

View 7 Replies

Flex - Degrafa States Memory Management?

Nov 10, 2009

I was recently profiling my application that uses Degrafa States in the skins and noticed that doing so uses more memory than I expected. Between the SetProperty and State, they were using about 10% of the total used application memory.

Would it be better to use css for the state changes and a new skin for each state? or Are there some simple tips to reducing the memory footprint of degrafa?

View 1 Replies

ActionScript 3.0 :: Memory Management With An Object Pool

Sep 8, 2009

I've been trying to figure out how Flash does its memory management regarding object declarations but haven't found anything that describes declarations themselves. [code]Basically I want a pool of declared variables that get instantiated only when a certain type is set. I'd have logic in other functions that figures out what the type is and then does certain things to it, but for now I just wanted to know what kind of memory management Flash does with something like this. Does it do nothing until I actually instantiate it (= new Object()) or will space be set aside once I simply declare it (someObj:Object)?

View 2 Replies

ActionScript 3.0 :: Memory Management And Garbage Collection?

Jul 19, 2010

In AS3, after I've removed a display object container B  from another display object container A and deleted all the references to B in A, does that mean that all memories previously held in B will all be released too or do I have to manually delete all the references to objects in B before I can delete B in A in order to free all the memory space held?One more question. I was kind of confused of when to use the delete statement and when to set a variable to null.

View 1 Replies

ActionScript 3.0 :: Loader Instances And Memory Management?

Aug 18, 2009

Hi guys, I'm wondering whether any of you have any opinions on whether you instantiate a Loader into an instance variable, or whether you declare a local variable to hold the Loader object.

I'm coming at this from a memory management / garbage collection perspective.

I only need the Loader object to load the file and register the event listeners. So I don't really want an object-wide instance variable to hold this loader object (which is what Adobe does in most of their examples), since I can always access the loader.data through the event's target property.

[Code]...

View 2 Replies

Actionscript 3 :: Memory Management When Instantiating Extended Classes?

May 16, 2010

I'm developing an AS3 application which has some memory leaks I can't find, so I'd like to ask some newbie questions about memory management.Imagine I have a class named BaseClass, and some classes that extend this one, such as ClassA, ClassB, etc.I declare a variable:

myBaseClass:BaseClass = new ClassA();

After a while, I use it to instantiate a new object:

myBaseClass = new ClassB(); some time after

myBaseClass = new ClassC();

and the same thing keeps happening every x millis, triggered by a timer.Is there any memory problem here? Are the unused instances correctly deleted by the garbage collector?

View 2 Replies

ActionScript 3 :: Memory Management - Adding Custom Objects To Stage

Jul 3, 2010

My AS3 application basically does the following (pseudo code from main application class) 3 or 4 times by adding custom objects to stage:

_movieClipClassVariable = new MyCustomSpriteSubclass();
_movieClipClassVariable.addEventListener(MyEvents.READY, function(event:Event):void {
_hideLoading();
mcHolder.addChild(_movieClipClassVariable);});
_movieClipClassVariable.addEventListener(MouseEvent.CLICK, myClickHandler);
private function coverClickHandler(event:Event):void {
}

What is the right way to allow Garbage Collector to recycle _movieClipClassVariable after it is not necessary? Assign null to it? Remove all listeners? Use weak reference for listeners?

View 2 Replies

ActionScript 3.0 :: Memory Management - Creating Instance Variable For Class

Nov 7, 2011

I have a question regarding AS3 memory management. Supposing I created an instance variable for a Class, in this case or type Sound:
public class SoundStore extends Sprite{
var s:Sound;
Then within various class functions I referenced this variable multiple times, each time I wanted to load in a new sound:
s = new Sound();
Am I correct in thinking that each time I created a new Sound I would be overwriting the previous allocated memory?

View 1 Replies

Actionscript 3 :: Difference Between Primitive / Non-Primitive Objects For Memory Management?

Jul 4, 2011

my understanding is that primitive types (uint, string, Number, etc.) of a class do not need to be set to null for garbage collection.

for example, i am not required to write this dispose() method in the following class:

package
{
//Imports
import flash.display.Shape;

[Code]....

if this is true, which i believe it is, what is the difference between objects of primitive types and objects of non primitive types concerning memory allocation?

View 2 Replies

ActionScript 2.0 :: Flash With Memory - Make A Screensaver With Posibilitys To Make Notes Like 3M Post-it Notes?

Apr 3, 2004

I would like to make a screensaver with posibilitys to make notes like 3M post-it notes, the flash file should "remeber" the input that the user writes. I have the tools to make screensaver in Flash, but how to make such a flash file?

View 3 Replies

Actionscript :: Capture Video To Memory And Play Back

Feb 25, 2012

I want to use the ActionScript 3 Camera class to capture a video from a local camera (webcam, built-in camera, etc) and then play that video back within the flash application.I'm considering the possibility of sending it to a Flash Media Server and then streaming it back as an on-demand video, but I would ideally like to keep the whole thing client-side for best performance.I'm open to the idea of using a different platform (Java was one consideration) as long as it can be embedded in a web page, but I would like to keep development as straightforward as possible and make the process of accessing the application as easy as possible for the end user, which is why I chose Flash initially.

View 2 Replies

Flex :: Flash - Total Memory Usage And TaskManager Memory Usage Are Different?

Aug 24, 2010

I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.

View 2 Replies

ActionScript 3.0 :: Make A Color Memory Game?

Mar 1, 2010

I am trying to create a memory game, where about five or six (doesn't matter how much) different colours com up and flash for a second and disappear in a random order.

Then the user has to try to match them again buy clicking on the colours that they have infront of them in the same sequence as the lights went.

Is there a way to make this game so it will tell you when you are wrong or right, and also is it possible to make the flashing colours random each time you play it?

View 1 Replies

Easy Depth Management In Flash?

Mar 2, 2009

I've recently created a game in which the logic and programming all runs perfectly, however the graphics are lackluster. I'm currently having a hard time managing the depth of movieclips on the screen.Basically the game is tile based and each frame of the movieclip holds a different type of tile. All the tiles are 50x50 with the exception of one type of tile which is 60x60 and therein needs to overlap the tiles around it which are 50x50.In AS2 I could of set the depth manually, however I'm told (as is this is my first time dealing with depth in AS3) that I cannot do this anymore. Is there any suggestions on how I can make sure that a tile of one type is automatically set beneath tiles of another type - I've thought about simply coding a function to check this but it somehow seems inefficient (considering larger maps will have a lot of tiles, meaning hundreds of movieclips attached to the stage, each movieclip with multiple frames).

View 2 Replies

ActionScript 3.0 :: Garbage Collecting - Make Sure There Are No Memory Leaks?

Feb 9, 2010

What's necessary to do when removing an object to make sure there are no memory leaks? Do you have to remove all children? Or just remove all event listeners? Or both?

View 1 Replies

Flash :: Professional - How Many Database Management Systems Available Like Xml

Mar 17, 2010

how many external sources available in flash like xml....

View 1 Replies

Flash :: Professional - Activate Colour Management In CS4?

Apr 10, 2010

I am struggling to find clear guidance on how to switch on colour management in Flash CS4. My attempts to search online have tended to give me far too many irrelevent results and it is not even mentioned in the index of my 700 page Flash CS4 textbook.

View 16 Replies

Flash - Asset Management In Adobe Air For 2D Game

Jun 1, 2011

I'm building an Adobe AIR application (2d platformer adventure game), utilizing the Flash Builder 4 IDE, which will be packaged on a CD for installation. I've embed the majority of the game assets into a static class to keep it simple and organized. This way I can reuse assets and swap them without much digging.

Example:
[Embed(source = "../data/gfx/spritesheets/boyHero.png")] public static var boyHero:Class;

In the early days of the projects, everything went to plan. However as the project has grown to be over 28MB, I've started to run into Out Of Memory errors. These occur when I add new assets, refactor for a while, or add new classes. Once I get this error, I can restart FB and then work for another 15-20 minutes. I've modified my .ini file bump up Flash Builder 4's memory allocation. It's currently set at:
-Xms512m
-Xmx1024m

While I'm at it, here are the specs/plug-ins that I've got installed:
Flash Builder v 4.0 (build 272416)
JNA Library 3.2.7
subclipse plugin 1.6.17
subversion client adapter 1.6.12
subversion JavaHL Native Lib 1.6.15
SVNKit lib 1.3.5.7406

Mac OSx v 10.6.7
2.53 GHz Intel Core 2 Duo
4GB DDR

My Questions:
1) Is the issue with the path that I've chosen for the way I'm handling in-game assets? I am streaming in some assets such as tutorial swfs which are loaded via the SWFLoader. I could go this route for all assets... but, should I? Is this the right way to handle a disk game? (The game runs without a hitch when installed on QA machines...)
2) Provided the embedding of static assets isn't an issue, Is this a FB4 bug? Where should I head for more information?

View 1 Replies

ActionScript 2.0 :: Flash CRM (Content Management System)?

Aug 28, 2010

Is there a best way to put a content management system into a Flash website so (very IT illiterate) people can update text on certain pages? Im expecting a simple notepad document that they can FTP to a specific folder is the best way but I didnt want to give them access to the entire site.

View 5 Replies

Actionscript 3 :: Flash - Display List Management In Applications?

Nov 4, 2009

Does anyone have suggestions for a good method to manage the display list in an actionscript 3 project? I'm building an application at the moment and keeping track of all the modules which need to be displayed and reordering them has become unwieldy.I have loaded swfs and instantiated classes that also load in swfs, images and video.. Should I just reference everything to the stage? How should I keep track of the display tree? How can I always force one particular module to the top of the tree?

View 3 Replies

Flash :: Build A Giant Management System In Flex 4.0?

Feb 17, 2011

I am planning to build a giant management system in Flex 4.0, and I just wanted to know what are some pros and cons of using 4.0 (or 4.2) over 3.5? Lighter components? Faster pipelines? What are some things I can look forward to when using Flex 4.0?

View 2 Replies

Flash :: Task Management, Threads And Other Foes In Builder?

May 31, 2011

I'm building a simple task manager that will at this moment execute tasks in a serial manner. I have been reading about threads in flex and it seems it is not quite clear/prepared for real threads.

What I'm looking at this moment is a way to execute a method at the beginning or end of a flash builder update. This method will be the one that will take the responsibility to start tasks added in the previous update. The removing of finished tasks will be done through event notification (the task will notify it finished) then the scheduler will remove it and dispatch the message again to let the outside world know the task was over.

[Code]...

View 1 Replies

ActionScript 2.0 :: XML,PHP,CMS - Flash Gallery Content Management System?

Sep 17, 2004

I have a meeting with a potential client this upcoming Wed. If I am hired, I will be redesigning his website, the major components he wants are galleries of his sculpture art and a way to update the images himself.

My idea: develop a custom CMS so he or his secretary can easily update what images are in the online flash galleries. My idea right now is an HTML/PHP form where they would enter what gallery the image goes to and maybe an upload button for the image, they hit submit and the PHP form edits an XML document which is where the gallery gets its image info from. Can anyone help me figure out how to do this? Or if there is an easier way to develop a CMS for them to update the images in the gallery themselves? Being able to remove images via a custom CMS would be ideal.

View 7 Replies

ActionScript 2.0 :: XML Flash Offline Content Management System

Mar 21, 2005

I'm working with FLash+XML, and I had a thought: I don't want to give my clients Flash+XML solutions, if they will have to edit the XML themselves. It's too complicated for them.So I thought of a Flash Application for offline use, that would be some sort of a XML Content Management System, built in flash, suitable for offline use (user should upload updated .XML files which is OK). In this app, creating / editing / removing nodes should be like managing folders and their content in Windows Explorer.I don't believe my mind is bright enough to be the first having this idea, perhaps such program already exists. Does it?

View 2 Replies

ActionScript 2.0 :: Flash Offline Content Management System

Mar 21, 2005

I'm working with FLash+XML, and I had a thought: I don't want to give my clients Flash+XML solutions, if they will have to edit the XML themselves. It's too complicated for them.So I thought of a Flash Application for offline use, that would be some sort of a XML Content Management System, built in flash, suitable for offline use (user should upload updated .XML files which is OK). In this app, creating / editing / removing nodes should be like managing folders and their content in Windows Explorer!

I don't believe my mind is bright enough to be the first having this idea, perhaps such program already exists. Does it? If not, please enlighten me: which kind of function allows me to "write to XML file, offline"?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved