Monday, 15 June 2015

actionscript 3 - How is this Hello World-style swf causing a massive memory leak? -



actionscript 3 - How is this Hello World-style swf causing a massive memory leak? -

make swf out of this, run through ie, , watch memory keeps growing - , perchance skyrockets - reasons appear out of flash programmer's control:

package { import flash.display.sprite; import flash.events.*; import flash.media.*; import flash.net.*; import flash.utils.timer; public class hellocam extends sprite { private var m_tmr:timer = new timer(5000, 1); public function hellocam() { stage ? init() : addeventlistener(event.added_to_stage, init); } private function init(pevent:event = null):void { removeeventlistener(event.added_to_stage, init); (addchild(new video()) video).attachcamera(camera.getcamera()); m_tmr.addeventlistener(timerevent.timer, ontimer); m_tmr.start(); } private function ontimer(pevent:timerevent):void { removeeventlistener(timerevent.timer, ontimer); navigatetourl(new urlrequest("http://someip/hellocam.swf"), "_self"); } } }

this not isolated 1 particular program. we've been dealing issue started out in much bigger software where, if have camera object , video object, supply local feed user, , maintain performing redirects same site, there serious memory leak.

(it's worse on machines on others, it's there. we've seen instances nail threshhold, go little, , skyrocket there without farther hindrance.)

we've tried several things, including wrapping browser in .net programme , handling refreshes through .net, not through flash. we've toggled between different things site in different refreshes. stuff.

this @ core of flash , it's intended for, there way (hopefully aside using debug swfs , flash players) stop such memory leak, or adobe/microsoft sloppy?

there's nil in code cause memory leaks. or not ie problem. although find unusual "refresh" app every 5 sec, it's not elegant solution.

now know leak coming you'll need profile swf. recommend use adobe scout, provide detailed profiling memory, cpu time, garbage collection runs etc.

i think it's way you'll know causes memory leaks, because need remember flash runs in virtual machine, other swfs cause memory leak. you're reloading app , making new photographic camera every time. garbage collector doesn't run , memory gets allocated until point when vm decides run gc.

actionscript-3 flash memory-leaks camera garbage-collection

No comments:

Post a Comment