HistoryOfEverything icon indicating copy to clipboard operation
HistoryOfEverything copied to clipboard

App Exits Randomly

Open luigi-rosso opened this issue 7 years ago • 5 comments

I've seen this happen after hot reloading quite a few times in a development session.

I'm not sure if it is related to a memory leak, but it sort of looks like a memory issue. No errors reported, I haven't profiled for it yet either but I saw it enough times today that I wanted to make sure we are tracking it.

It would be really good to get people testing the release build.

luigi-rosso avatar Nov 04 '18 02:11 luigi-rosso

I think I've seen this as well, in profile (~= production) mode. No error was logged.

filiph avatar Nov 04 '18 10:11 filiph

After first opening the timeline in profile mode, I saw memory usage around 720MB. screen shot 2018-11-04 at 11 08 53 am

After scrolling around a bit it popped to 770 with a peak of 899. This seems crazy high to me.

I think the reason our memory usage is so high is because the images need to be decoded and stored as raw RGBA at runtime. I also think SKIA must be generating mipmaps for them for the filtering.

We exported them at best quality from Nima, but this isn't really necessary as we render at a much lower resolution in the app. I can write a script that goes through and resizes the atlases. I'll move all the originals into a new folder and have a script that can be run to re-generate the ones in the assets folder from the originals. That way we can play around with different resolutions and see which is the best balance for memory/quality.

luigi-rosso avatar Nov 04 '18 19:11 luigi-rosso

More proof that it's the images. These lists of images are the arrays of atlases each actor stores.

screen shot 2018-11-04 at 11 18 32 am

luigi-rosso avatar Nov 04 '18 19:11 luigi-rosso

If I 1/4 (512x512 max) the images, it goes down to 220MB. Quality is bad. At 1/2 (1024x1024 max) the images, it goes down to 443.8MB. Quality change is only noticeable in some cases, but generally seems good.

A few more options: Change some of the larger images (the galaxy, the big bang) to Flare (vector) animations. These seem like an easy win.

Look into loading the assets on demand instead of everything at boot.

luigi-rosso avatar Nov 04 '18 19:11 luigi-rosso

There are two utility scripts: tools/resize_large_assets.dart and tools/find_large_assets.dart

luigi-rosso avatar Nov 04 '18 19:11 luigi-rosso