Memory usage on iOS and HTML5 targets


I’m working on an app that compiles to both HTML5 and iOS targets, both using Lime and the latter using hxcpp. It uses a good number of image files that, along with some other project elements, are currently causing some memory issues on iOS. There are, however, no similar issues in HTML5 and after some investigation it seems as though there’s about a 200 mb difference in the project’s runtime memory in Chrome (observed with a performance snapshot) and on iPad (observed with the Instruments tool.)

The reasons for this could be complicated and related more to the respective browser/OS operation than how Haxe is compiled to target them. Regardless, I was wondering if anyone had any insight as to why there might be such a big memory difference, and if that might be something to incorporate into other memory management solutions. For example, do textures round up to pow2 on one platform but not another?

If anyone had any suggestions about things to investigate or measure that would be really useful as well.


We should have bitmapData.disposeImage (), which disposes the software representation of your BitmapData, so it works only as a GPU texture only. This should be fine so log as you do not read/write the pixels, but will help reduce your memory use. If you do not need an image later in your project, be aware that openfl.utils.Assets uses a cache by default, so you may need to load your files with cache = false or use Assets.cache.removeBitmapData (id); later on to be sure that it can be garbage collected. Lastly, the HXCPP memory system does not always garbage collect, if it thinks there is enough RAM to not force a collection… so sometimes the memory usage looks higher