Skip to content

Memory leak rendering to larger resolutions on iOS (3.85.x) #6914

@mikaleerhart

Description

@mikaleerhart

Version

  • Phaser Version: 3.85.2
  • Operating system: iPadOS 18.0
  • Browser:

Description

I followed this tutorial the other day when porting the game I'm working on to mobile. I compiled and ran their example game rendered to the native resolution by calculating window.innerWidth * window.devicePixelRatio by window.innerHeight * window.devicePixelRatio. Using Capacitor, the tutorial game ran just fine at that resolution on all devices I tested (I have various iPads, iPhones, and Android devices). But when I tested my game it ran fine on everything but iOS, specificially devices with a screen resolution of larger than ~2200px high (I tested by rendering my game to specific sizes up until the leak appeared). The page would continuously crash and reload, and in Xcode, this is the error I'm getting:
Screenshot 2024-10-04 at 11 12 47 AM
The error only happens on the physical device, my game ran in the simulator.

My game runs fine on iOS in Phaser v3.85.x at lower resolutions than mentioned above. I couldn't figure out why the example game ran without error at full resolution and mine did not, so eventually I tried switching to the version of Phaser used in the tutorial, v3.80.1 and the error went away and my game rendered at the full resolution. I've never looked deeply into the source code of Phaser but I've been scratching my head over this for some time now and finally got to the bottom of it, so I figured I'd report this.

Example Test Code

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions