Hey friends,
Last night I hunted down a really weird phenomenon in my NME project's Flash target. I was seeing a sawtooth graph for its memory usage in Adobe Scout, and after some digging I isolated the problem to a Haxe function that doesn't explicitly create objects.
What it does do is manipulate Arrays– although I didn't explicitly type the array variable. And by sampling object allocations with flash.sampler.Api, I discovered that Arrays indeed were the primary type of object being allocated as the project ran.
By replacing those Arrays with Flash Vectors (nme.Vector) and explicitly typing the variables in that function– now necessary, because otherwise Haxe's type inferencing seems to type the objects to Arrays– I managed to get rid of the sawtooth graph entirely.
But would making this change have this effect? And how does a function that uses simple Array indexing end up creating Array objects when run? Was AS3's Array(obj) casting going on under the hood? That's my only hypothesis...