I have a web app that contains a huge amount of generated JavaScript. The memory consumption differs by a factor 6 between running the web app in Chrome on a Desktop compared to running the web app in a UIWebView
on an (updated) iPad.
What constructs or patterns should I avoid to get the memory consumption on iOS on par with that of Chrome?
Characterisation of the generated JavaScript:
prototype
, but in a civilized way.There does not appear to be any memory leaks; the excessive memory consumption on iOS shows immediately upon construction of the (fixed set of) Javascript objects.
Since your code does run well on the desktop it is probably some underlying quirk in iOS. Which I doubt you can fix using a more object oriented way of programming. Sure this might reduce the memory footprint a bit but not by a factor of 6.
UIWebView is quite notorious for creating memory leaks you could try to use the newer (iOS 8+) WKWebView has much better garbage collection.
Apple WKWebView Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With