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


Similar Posts:


ActionScript 3.0 :: Movieclip = Null; Garbage Collecting?

Jul 26, 2010

after strolling through the internet looking for garbage collecting of dynamic movieclips i conceded and justified to myself i should make a forum post.I'm making a small game, with many many explosions. Explosions are random swfs which i cache before using them. Problem is that although i did everything to make them ready for garbage collecting, they seem to overflow the memory.my code:

Code:
package
{
import flash.display.MovieClip;[code]....

the last line, 'e.target.parent=null ', is the way i know how to make movieclips ready for garbage collecting. But if i uncomment the line, I get this error:

Code:
ReferenceError: Error #1074: Illegal write to read-only property parent on example03_fla.MainTimeline.
at Explosions/::doneHandler()
at flash.events::EventDispatcher/

example03_fla is the timeline of the supposed movieclip i'm trying to delete, not the document fla.

View 9 Replies

ActionScript 3.0 :: Trace Object References For Garbage Collecting?

Oct 12, 2009

I'm trying to get my head around optimising AS3 code and clearing things out for garbage collection.

I understand that each time an item is referred to in the code it has its reference count increased by one, so I was wondering if there is a trace option I can use to see how many references each of my objects has?

I can then see where things are getting left behind (if they are) and where I can make optimise better.

I think it would help me work out several issues if I was able to do this

View 1 Replies

ActionScript 3.0 :: TweenLite CPU Optimization - Just Stacking And Never Garbage Collecting?

May 12, 2011

I'm currently working on a game where every "Step" - defined by a global time modifier - everything on screen calculates where it's next position will be, then uses tweenlite to animate itself to that location. This program runs for about 10 seconds before it eats 100% of my CPU. iMac i5 quad core, so it's not the hardware.

The problem is specifically in the following snippet, and the peculiar thing is if I teleport everything to it's next position (i.e. don't tween it there) the CPU is stable at 6% (where flash IDE consumes 4%). Does anyone know why these tweens are just stacking and stacking and never garbage collecting? (This is what I assume the problem is, as I can't find another explanation as to why the problem only exists when i TWEEN to the next location)

[Code]...

View 3 Replies

ActionScript 3.0 :: Identifying Memory Leaks?

Feb 23, 2007

I have an AS3 application which seems to be leaking memory slowly while running. I've been looking for a profiler for Flex 2 / AS3 and haven't been able to find one yet, in fact I saw posts from people at Adobe saying they were working on it but no release in the short term!

Does anyone have any more news on this, or more usefully have any information on a profiler or other way it is possible to find memory allocation and usage during runtime of an AS3 application? It would really help me to identify what areas of my application are leaking memory.

View 4 Replies

Flex :: Spot Memory Leaks In Profiler?

Jul 20, 2009

I have an AIR/Flex app I made, I have a few people testing it and everyone is reporting that after leaving it running for a while, it is making all there machines run very slow. It runs fine at first so this must be a memory leak somewhere. I used the profiler on this and the only thing that shows as using a substantial amount of memory is MethodQueueElement which is not a class I wrote, and I have no idea what it does, I am assuming its part of the Flex framework. I am not familiar with using a profiler so I am not sure what all I shuld be looking at, that was the only class that was high on "memory" and it said it had over 100,000 instances. If this is my problem what can I do to fix it?

View 1 Replies

Flex :: Detect Memory Leaks In Flash?

Feb 11, 2010

How do you know if your compiled SWF file has a memory leak?

Are there tools, a firebug setting, etc... to see if there is a problem? I cannot find much in the debug Flash player besides file size and loading time.

I have a large Flash application that I maintain and suspect that is using way too much memory so I wanted to measure the amount of RAM being used while it executes to find key areas to optimize.

View 3 Replies

Flex :: Track Down Memory Leaks In The Application?

Feb 14, 2011

I've been trying to track down memory leaks in our application, and keep finding myself back looking at Spark components as the culprit.

Many classes in Spark use RichEditableText for displaying their text properties (ComboBox,TextInput).RichEditableText has a local textContainerManager property, and frequently calls compose() on this.Here's the relevant abridged extract from TextContainerManager

// Line 282 - 292:
static private var stringFactoryDictionary:Dictionary = new Dictionary(true);
static private function inputManagerStringFactory(config:IConfiguration):StringTextLineFactory
{

[code]...

Line 1242 is the crucial line here, as it gives the static dictionary a reference to our component.(Note - I've checked this with the debugger to confirm which branch of the ternary gets executed.) This would prevent the instance from ever being garbage collected.

Eg: Static dictionary has a value with a reference to the instance -- instance cannot be GC'd.In turn, this would prevent any other instances which have a reference to the instance of TextContainerManager from being GC'd also.While this theory certainly matches what I'm seeing in our app, I can't beleive that there really is a memory leak in such a low-level spark component.

View 1 Replies

Flex :: Cairgrom ModuleLoader Memory Leaks?

Mar 23, 2012

I also found this topic but it doesn't fix my problem other topicI have a module loader that load other swc's but when I look at the memory off the application it seems that each time a module gets loaded the previous module doesn't get unloaded and so the memory increases..

This is how I load the modules:
<module:ModuleViewLoader id="moduleViewLoader" moduleManager="{presenter.deviceModuleManager}"

[code].....

View 1 Replies

ActionScript 3.0 :: Memory Leaks Eventlisteners And New Sounds?

Oct 13, 2010

Memory leaks eventlisteners and new sounds. I have written up a media player code, which does what it is supposed to do, but the System.totalMemory steadily increases with time.My code essentially consists of nested calls using EvenListeners that trigger initiation of new sounds. I call up mp3 files that load and start play and on EventCOMPLETE load the next file Example of code snippet:

ActionScript Code:

function LoadNextTheme(e:Event = null):void // set next theme
{
if (A_play)  {

[code]....

What parts of this kind of code keeps adding to total system memory?And how can I best stop that leak?

View 1 Replies

ActionScript 3.0 :: Unexplainable String Memory Leaks?

Dec 23, 2010

I developed a game in AS2, and got a decent sponsorship deal, but I had to convert it to AS3 for them. I've been working my way through and it's pretty much done, but I've found I'm getting big memory leaks. I'm not sure if they were there in the AS2 version, but I need to clear them out in either case. I couldnt get the flex/flash builder 4 profiler to work, but I did manage to get this profiler working: (ok I can't post links, but put flashpreloadprofiler into google and you'll find it)

It does seem useful for working out where all the memory is being allocated. It lists "String" as a large contributing factor, and I've narrowed half of that down to this one simple function, and I can't understand why it would cause memory leaks. I wrote a function to check if a movieclip exists on stage, in order to then do things like hittest against it without errors if it doesn't exist. Here's the function:

[Code]...

View 3 Replies

ActionScript 3.0 :: Memory Leaks Eventlisteners And New Sounds

Oct 13, 2010

Memory leaks eventlisteners and new sounds.I have written up a media player code, which does what it is supposed to do, but the System.totalMemory steadily increases with time.My code essentially consists of nested calls using EvenListeners that trigger initiation of new sounds. I call up mp3 files that load and start play and on EventCOMPLETE load the next file.[code]What parts of this kind of code keeps adding to total systemmemory?

View 3 Replies

ActionScript 2.0 :: Memory Leaks When Loading In External Swfs

Dec 8, 2009

I have a problem in that i have a holder swf which loads in other swf's externally. My problem is that the holder loads all the movies in correctly but the memory usage of the swf just keeps going up and up even though i am trying to remove the movieclip after each has finished it's run.

[Code]..

View 0 Replies

ActionScript 2.0 :: Memory Leaks In Loading / Unloading Pictures

Nov 15, 2011

I load image from url like this
Code:
imageholder = this.attachMovie("imageholder", "image", this.getNextHighestDepth());
imageholder.swapDepths(selectMenu);
loader.loadClip(uri, imageholder.bigImage_mc);
this== root, imageholder is MC that contains empty MC named bigImage_mc, selectMenu needs to be in front of loaded image (2nd line) and loader is MovieClipLoader()

Image is unloaded and removed like this
Code:
loader.unloadClip(imageholder.bigImage_mc);
imageholder.swapDepths(selectMenu);
removeMovieClip(imageholder);
but when I unload image it doesn't free any memory, and when i load new image it increase memory usage...

I even tried
Code:
System.gc();
System.gc();
after removeMovieClip(); as I found this on some website... but with no improvement

View 3 Replies

ActionScript 3.0 :: Loading / Unloading External SWF - Prevent Memory Leaks

Sep 19, 2011

Im creating a flash projector which has a holder swf with an empty movieclip. A series of external SWFs are loaded into the empty movieclip on the push of a button. Once the clip has been loaded, other external SWFs can be replaced in the empty movieclip at the push of a button. As memory leaks and garbage collection seem to be an issue, I was wondering the most memory efficient way of loading, unloading and replacing these external swfs so that memory leaks are kept to an absolute minimum.

View 1 Replies

ActionScript 3.0 :: Memory Leaks - Variable Reference Inside A Function Or Outside It?

Mar 11, 2009

I wonder what the most common reasons for memory leaks in AS3 are.First thing what I am not sure about is: is it better to have a variable reference inside a function or outside it. Will the variable be null-d automaticly inside a function or when do I have to null it and when not?I have massive problems with my game with memory leaks. I noticed I reference some of the clips of the timeline even inside my debugging clip to display propertys and this was causing collecting huge amount of memory.But even before I go into the game with bigger objects the System.memory is slowly growing and growing.I just have a socket connection and some interval loops and enter_frame events.

View 5 Replies

ActionScript 3.0 :: Memory And Garbage Collector?

Sep 23, 2010

fully removing objects from memory, but I still think I'm not getting it. I've written a test script that looks the following:The stage has is of class MemTest

Code:
package
{
import flash.display.*
import flash.events.*

[code]...

There is approximately a 3x difference in the rate of gain of memory usage between simply letting the movieclips accumulate or running removeChildforever() in the enterframe. There doesn't seem to be a difference between using the "killme = null;" line or not.However, I am still seeing an constant rate of increase in memory usage of about 3 megs over the course of a minute, running at 120 fps. why is the memory usage still going up? Is garbage collector run so infrequently that it hasn't happened after 7200 frames?

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

ActionScript 3.0 :: Garbage Collection Memory Never Frees Up?

Feb 9, 2010

I am concerned about the garbage collection in my projects. Whatever dynamic memory i am allocating, never seems to free up and it just keeps adding (i check in Windows Task Manager). e.g. I am adding bricks (movie clip) this way:

[Code]...

View 6 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 :: Identify Memory Leakage - Garbage Collector?

Jul 3, 2011

I've coded a 2000 line game on one actions layer (facepalm*) and I just recently learned about the GC (garbage collector). I've looked around a bit and can't, how to trace the source of it. There is an interesting article that mentioned event listeners and for every addEventListener there should be a removeEventListener. My game has 60 adds and only 15. What I can't make sense is that the mc's that have the event listeners are never removed, but just moved off of the stage. Others are just made invisible. So if the event listener is added once, why would the memory keep growing? (I'm using the Windows Task Manager to monitor this). Another point was to remove objects so that the GC can do its work. What I did was create an object, add it to an array then null it.

_object1 = new _barrel();
_object1.x = objectPosition;
_object1.y = _defaultFloorBoundary.y;
instanceArray[objectNumber] = _object1;
_object1 = null;
 
Then removed the object from the array.
for ( var ii:int = 0; ii<instanceArray.length - 1; ii++ ) {
stage.removeChild(instanceArray[ii]);
delete(instanceArray[ii]);
instanceArray[ii] = null;
}

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

Flash :: Memory Usage And Garbage Collection Of Objects?

Jun 1, 2011

I want to know about the Object type specifically when it comes to garbage collection in Flash.

I know that items will be ready for garbage collection in situations like this:

[Code]...

View 2 Replies

ActionScript 3.0 :: Remove / Unload External Swf File(s) From The Main Flash File And Load A New Swf File And Garbage Collection From Memory?

Sep 12, 2009

I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?

View 15 Replies

Flex :: Make Objects Eligible For Garbage Collection?

Nov 12, 2009

How do I make Flex/ActionScript 3 objects eligible for garbage collection? What are the thumb rules?

View 5 Replies

ActionScript 3.0 :: Collecting User Data?

Aug 24, 2010

I've got to create a form with 2 fields (Name, email adress) that users can type their information into, but i then need to collect the data and store it somewhere (so i would then have a file showing everyone's names and email addresses that have been entered).I have quite a good knowledge of flash front end development but don't know alot about hooking stuff up to xml/php whatever

View 1 Replies

Actionscript 3 :: Collecting And Identifying Functions Within An Array?

Dec 28, 2011

I want to do something where I collect functions to be invoked later when a certain condition is met. E.g.

function doSomething(someArg:Object):void {
if (conditionIsFalse){
operationsToDoWhenConditionIsTrue.push(function(){
doSomething(someArg);

[Code]...

Basically if doSomething is called twice, I only want operationsToDoWhenConditionIsTrue to hold the most recent invocation. Obviously since the invocations are wrapped in function(){} all the functions are the same. Is there any way I can accomplish what I want?

View 1 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

Flash - Collecting High-volume Video Viewing Data?

Apr 5, 2010

I want to add tracking to our Flash-based media player so that we can provide analytics that show what sections of videos are being watched (at the moment, we just register a view when a video starts playing)

For example, if a viewer watches the first 30 seconds of a video and then clicks away to something else, we want the data to reflect that. Likewise, if someone watches the first 10 seconds, then scrubs the timeline to the last minute of the video and watches that, we want to register viewing on the parts watched and not the middle section.

My first thought was to collect up the viewing data in the player and send it all to the server at the end of a viewing session. Unfortunately, Flash does not seem to have an event that you can hook into when a viewer clicks away from the page the movie is on (probably a good thing - it would be open to abuse)

So, it looks like we're going to have to make regular requests to the server as the video is playing. This is obviously going to lead to a high volume of requests when there are large numbers of simultaneous viewers.

The simple approach of dumping all these 'heartbeat' events from clients to a database feels like it will quickly become unmanageable so I'm wondering whether I should be taking an approach where viewing sessions are cached in memory and flushed to database when they become inactive (based on a timeout). That way, the data could be stored as time spans rather than individual heartbeats.

View 2 Replies

ActionScript 3.0 :: Triangle Maths - Collecting Stars That Appear At Random Moments?

Jan 13, 2012

i want to finish it in the end! i have this code which generated 20 stars and an ai player collects all of them (going for the one which is closest to it). This code was courtesy of -lauri... the code was

ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;[code].........

what i have currently is a player who moves around with the arrow keys collecting stars which appear at random moments... i wanted to make it so that the ai can also collect these stars and i am pretty sure that the code for that would be linked to what.

View 6 Replies







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