actionscript 3 - Is there any way to avoid string leakage? -


I have a flex code in which I allocate value multiple times for a string variable. I expect the garbage collector to remove the memory associated with previous work, but it does not seem like that. Every time I make an assignment (memory by clicking on the image, which calls on the mouse room) increases with the profiler, and not only for the first time. Apart from this, it does not decrease.

Here's the code:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; S: application xmlns: fx = "http://ns.adobe.com/mxml/2009" xmlns: s = "library: //ns.adobe.com/flex/spark" creationComplete = "doinit ()" & gt; ; & Lt; Fx: script & gt; & Lt ;! [CDATA [var backup: string; Private Function doInit (): Zero {img.addEventListener (MouseEvent.MOUSE_DOWN, onMouseDown); } Private Function onMouseDown (Event: MouseEvent): Zero {backup = getSubStr (); System.gc (); } Private function getSubStr (): string {var subStr: String = new string; Var x: number = Math.Random (); For (var h: int = 0; h & lt; 8000; h ++) subStr + = x.toString (); Return subtract; }] & Gt; & Lt; / Fx: script & gt; & Lt; S: Image ID = "IMG" source = "@ Embed (source = 'spec / map' ')' / 'gt; & lt; / s: application & gt;  

complete In the code, I do not call the garbage collector, it is done only for testing.

I have read that flash using the master string.Propiler for the profiler string looting objects "substrate + = X.toString (); "I think the combination of strings can be related to this problem. Nki I do not know how to stop the leak.

would appreciate any feedback.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -