October 29th, 2007
Flash: Every increasing system memory
A buddy of mine IM'd me last night and came across an interesting behaviour in Flash. He had been trying to hunt down a memory leak in his Flash AS3 project and did a simple test using an Enter_Frame loop and traced out System.totalMemory. His tests showed totalMemory going up just a little over time. I tested it on my side and even testing it in Flex and got the same behaviour. It's very small, but I was curious why this was happening.
Here is the very simple sample code in Flash CS3 (you could repeat it in Flex as well):
CODE:
-
addEventListener(Event.ENTER_FRAME, repeater);
-
-
function repeater(evt:Event) {
-
trace("System memory:"+System.totalMemory);
-
}

2 Responses to “Flash: Every increasing system memory”
I would say it’s the creation of an Event object on every frame. I should be GCed eventually.
By Alex Bustin October 29th, 2007 at 4:34 pm
I’m not sure if that’s what you’re referring to, but remember system memory is the memory USED by the system, not memory available.
By Tim October 29th, 2007 at 6:17 pm