Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari: total canvas memory use exceeds the maximum limit (256 mb) #474

Open
Sandstedt opened this issue Jul 31, 2020 · 2 comments
Open

Comments

@Sandstedt
Copy link
Contributor

Sandstedt commented Jul 31, 2020

Get's this error:
total canvas memory use exceeds the maximum limit (256 mb) in IgeTextureMap.js and some more places, and then IGE will get into an infinite loop.

This only happens in Safari on iOS 13.6 (the only one I tested in). Usually after navigation back and forth to the game.

Works when closing the tab and opening again. Probably some memory leak somewhere.

The infinite loop can be temporarily solved by changing all instances of ctx and return if it doesnt exist (but is of course a better sollution to fix the root cause):

if (!sectionCtx) return;

in IgeTexureMap.js:492 (.getContext('2d') returns undefined

if (!ctx) return;

in IgeTexureMap.js:640 (ctx is null here)

if (!ctx) return;

inIgeFontSheet.js:58
(here you could add an alert() to tell the player to close and reopen the tab to fix it)

if (!this._ctx) return;

in IgeEngine.js:1035

if (!ctx) return;

in IgeEngine.js:1864

if (!this._cacheCtx) return;

in IgeEntity.js:137

And maybe some more places.

(Bug occurred in this project: https://www.papricaklubben.se/#start)

@Irrelon
Copy link
Owner

Irrelon commented Jul 31, 2020

Hey there, first of all, congratulations the project looks great.

I tested and moved around on my iPhone XS and couldn't produce the bug. I also did a memory profile in Chrome on desktop over time, moving around etc and couldn't see any memory leak.

Are you able to provide steps to reproduce this in a deterministic way? It's unlikely (although not impossible) that the engine has a memory leak in the files you've described because we'd have seen significant numbers of people raising issues around this before now I think!

Anyway, the project is very professional looking, would you like us to feature it on the home page of https://www.isogenicengine.com when you are ready to go live?

@Sandstedt
Copy link
Contributor Author

Thanks for trying it out and the kind words!

Forgot that I hadn't publish the latest version yet. Added two extra sprites in this version: https://papricaklubben.fullystudios.se/. So you can try there if you have time.

Reproduction using a iPhone S:

  • Enter the page
  • Click "Starta världen"
  • Refresh
  • -> Crash :(

Reproduction using an iPhone XR or XS:
Here it's was a bit harder to reproduce a single flow. I guess they have a bit more GPU memory. But usually this worked to reproduce the memory limit bug:

  • Enter the page
  • Click "Starta världen"
  • Scroll around in the world to ensure all sprites is loaded into the memory (i guess that's what happens anyway)
  • Click the red telephone booth (this is a entire different "app", not related to IGE)
  • Navigate back using browsers back button
  • Refresh the page three times
  • -> Crash (or repeat the above a couple of times)

The project uses IGE version [email protected] (according to the console logs), but does contain some later pull requests, but is probably a year old at least. Could try to use the latest stable branch too.

Could also probably remove or compress some sprites, and it should probably work again. There are currently a LOT of big hi-res sprites.

(And yes, you may add https://papricaklubben.se on the home page if you like :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants