Return to Starling Playback Library

Memory leak in GAF

Questions related to Starling playback library should be asked here.

Memory leak in GAF

Postby Lê Huy Hùng » December 17th, 2015, 9:05 am

I see my game is using too much memory. After check with Adobe Scout, i see my game have a lot of bitmap data in memory, i guess it used to restore texture when context loss. If I don't want keep bitmap data in memory, what must i do and do you provide a solution for me to restore texture but not keep bitmap data (like asset manager of Starling). I think this is very important because if game use memory so much, it will easily crash because the device is too hot. Sorry for my English skill is not very good, thank you :D
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Re: Memory leak in GAF

Postby vadym.mitin » December 17th, 2015, 10:18 am

Hi,

There is no solution right now that you can use without modifying GAF library. High level instructions how you can modify GAF library in order to achieve the result you can find here viewtopic.php?f=4&t=502

Right now we are investigating a possibility to implement this functionality in the library. But I can't give you an estimate right now.
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: Memory leak in GAF

Postby Lê Huy Hùng » December 17th, 2015, 8:01 pm

Thank for your answer. I will wait your solution. :D
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Re: Memory leak in GAF

Postby vadym.mitin » January 14th, 2016, 5:56 am

Hey,

We just submitted "restore texture atlases from the file system" into the master. https://github.com/CatalystApps/Starlin ... /issues/36

Please check and let me know if you face any issue.

Thanks
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: Memory leak in GAF

Postby Lê Huy Hùng » January 14th, 2016, 6:53 pm

Thank, I will update code. I am using AssetManager to loading ZIP. According your article, GAF library will restore texture atlases from the file system, so that it will not work on the Web?? I think, you should create a small example (and a document if you can) about this issue.
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Re: Memory leak in GAF

Postby vadym.mitin » January 15th, 2016, 2:29 am

Current realization will work only in AIR applications (mobile or desktop). There is no need create an example because everything will work automatically without any additional code. All that you need to do is pass File object, that represents a path to a gaf file or directory with gaf config files, to convert() method of the ZipToGAFAssetConverter.

Code: Select all
var gafAssetFile: File = File.applicationStorageDirectory.resolvePath("assets/gafAsset.gaf");
var converter: ZipToGAFAssetConverter = new ZipToGAFAssetConverter();
converter.addEventListener(Event.COMPLETE, this.onConverted);
converter.convert(gafAssetFile);

For WEB it's hard to find an easy way to restore texture atlases from ZIP. But we want to replace restoring from BitmapData on restoring from PNG as ByteArray. This will decrease memory usage. I will post an update here when it will be on git.
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: Memory leak in GAF

Postby vadym.mitin » January 18th, 2016, 2:16 am

Restoring from PNG is already on git. Just update library and it should work without any modification in your app. With this update you should see decreasing of the memory usage (noticeable in Scout after the BItmapData is collected by GC)
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: Memory leak in GAF

Postby Lê Huy Hùng » January 18th, 2016, 8:17 am

I tried new version but it has some problem. Memory of Texture is too big, ~4x than before, memory of byte array quite large, slightly difficult explain with my english skill, please see image and focus in memory of texture and byte array. Last but not least, memory of bitmapdata has decrease :D

Before
Image

After
Image
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Re: Memory leak in GAF

Postby vadym.mitin » January 18th, 2016, 9:23 am

Increasing of the ByteArray memory is expected result because instead of storing of BitmapData we are storing PNG as ByteArray. But in general total memory usage should be lower because PNG as ByteArray takes less memory than BitmapData.

About increasing memory of the Texture. From your snapshots I see that "Before" was taken at the frame 10195 and "After" - at the frame 4718. So it's not correct to compare so different frames. Maybe you have something that was unloaded from the video memory in range between 4718 and 10195 frames?

Anyway if you think that something wrong with the library - please send us a demo that we can use to recreate the issue. Because we are unable to recreate it on our demos.

Thanks
User avatar
vadym.mitin
 
Posts: 254
Joined: December 4th, 2013, 8:00 am

Re: Memory leak in GAF

Postby Lê Huy Hùng » January 19th, 2016, 1:54 am

Hi.
I suprise when you don't see this problem on your demos because it occur on all of my project :3

This is my demo
http://www.mediafire.com/download/6s262 ... Mobile.rar

According to your post, for Mobile, I can use file system to restore texture atlases instead ByteArray (file zip), is memory when use file system lower than memory when use ByteArray ??
User avatar
Lê Huy Hùng
 
Posts: 61
Joined: July 3rd, 2015, 8:32 pm

Return to Starling Playback Library

Who is online

Users browsing this forum: No registered users and 1 guest