[FIXED] Crash on iOS device and high memory peaks on Mac and IOS Simulator

josejulio

  • Posts: 5
Hello, i have been testing out the Dialog Extension, it's an awesome job, thanks you Justin, for taking your time to build it.

Sadly i have some issues when trying to run on an iPhone 5c, 5s and iPad mini, i though it was my code so i tried it using  the Dialog Extension Sample and it still crashes, i did some minor modifications to the Sample (adding touch to the Good Scene and removing sounds) but it still crashes when it finishes the first sentence ( Press V to advance.), the bottom-right arrow starts blinking bouncing and without pressing(or touching) anything it just crashes(sometimes it happens just before finishing the sentence).

Anyone knows a workaround to debug or where i could  start to look into to fix it or any idea that could help me? (please)

Notes:
  • It does work on the iOS simulator, Android devices, Mac and flash
  • The prior-to-crash image is an iPhone simulator for simplicity of taking the screenshot

Edit: added the  Modified Dialog Extension Sample

« Last Edit: September 20, 2014, 04:43:07 am by Justin »

josejulio

  • Posts: 5
Anyone could point me on the right direction to fix it?  I could help if i knew what file should i start looking for. Thanks.

It seems that there is a heavy allocation that causes the process to end because of memory warnings but i'm unsure where to start looking for.

edit: After a more detailed inspection on the simulator, i can confirm that there is a lot of texture allocation going on, which (on the simulator) goes from 20kb mem to 1gb (and it starts after i *touch* the "Press enter to start dialog").

« Last Edit: September 01, 2014, 03:10:16 pm by josejulio »

josejulio

  • Posts: 5
It also happens on the Mac build (but not as aggressive as the iPhone Simulator) about 300mb when the dialog starts.

edit:
So i started searching trough the code to find what was causing the issue, after many trace("...") i found out that the execution of the G2.drawImage was causing the issue: (G2.hx)
Code: [Select]
class G2
{
...
private static var count:Int = 0;

public static function drawImage(img:BitmapData, x:Float, y:Float)
{
               count++;
if (count > 400) {
return;
}
        ...
With this the crash and the heavy allocation is gone, however the drawing is also gone... so, on a closer inspection, on line 66 of the same file was: g.graphics.beginBitmapFill(img.clone(), mtx); so i removed the clone() part and it seems to works now, but i'm not sure if i broke something by removing that clone call.

As far i understand, the  clone is allocating resources faster than the system is releasing them, thus there appears a crash on my limited-memory iOS device.

I'll further test it and see if is behaving as should, but i would appreciate if anyone who knows more about this.

« Last Edit: September 02, 2014, 01:43:40 pm by josejulio »

Justin

  • *
  • Posts: 4529
Your fix has been included in the latest version. Thanks!
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)