Reputation: 51
I've run into a memory leak problem during programming AS3.
I try to format a text in as3 and adding it to the stage, but there happens something crazy.
This is a part of my code:
var format:TextFormat = new TextFormat();
format.size = 60;
var t:TextField = new TextField();
t.autoSize = TextFieldAutoSize.LEFT;
t.text = "WWWWWWWWWWWWWWWW";
t.setTextFormat(format);
t.scaleX = 1;
t.scaleY = 1;
this.addChild(t);
The moment I add this textfield to my stage and check the memory usage with adobe scout CC the "other bitmap memory" shows nothing weird and acts just fine.
BUT...
When I run this code and add a capital W to the text the "other bitmap memory" goes crazy.
The crazy thing is when I add a letter I to the text it just runs normal.
I think it has something to do with the width or the size of the font. Increasing the font size will give the same problems.
Does anyone now how to prevent this problem???
Im working with adobe flash builder 4.7 and adobe scout cc.
Upvotes: 5
Views: 563
Reputation: 445
I just came across the same issue where Other Bitmap Memory shown in Scout did strangely increase and never went back.
The renderMode also seems to have influence on this issue:
Setting the render mode to cpu in the app descriptor XML file does prevent the memory from increasing.
When the rendering mode is set to auto (default) then the memory will only increase when the app is in fullscreen mode.
If you set it to direct it will always increase, no matter if the app is fullscreen or not.
On renderMode gpu it will also always increase.
Changing specific signs in the spark "Label" may eventually prevent the memory from increasing but it's too broad to narrow this down.
Upvotes: 0
Reputation: 83
As you said, embedded fonts will fix this issue. In all the time I've used as3 I've only come across two honest to goodness bugs that actually prevent me from doing what the code should be doing. Both have involved textfields and font manipulation in very obscure ways.
Upvotes: 2