I may be having this same issue - is there any way to know how much VRAM is available on a device?
I have a single view IOS app with a webview containing my game that crashes. IOS Safari also is crashing.
I compressed some of the 2048 x 2048 images using the default settings and the affects on the VRAM were negligible
thanks,
Mitch
Nope, which sucks completely.
Surprised it makes no difference, you should see a significant reduction in VRAM usage
. Is there a build/published URL you can share?
You are shared on the project from a prior interaction! the branch is master2
https://playcanvas.com/editor/scene/1300676
Is it my understanding that textures that are not power of 2 size cannot be compressed at all?
Would love any tips you have, can also do a build with and without compression if that is helpful
That is correct.
Have you looked at the profiler and checked VRAM usage? Whatâs the most you are using without Basis? A quick playthrough shows 55MB total which shouldnât crash iOS (Master branch)
Master branch is old dont use that - its master2 is the main one now. I got 78 MB max by playing a bunch of games. on IOS i can crash it if i pull it up and as quickly as i can login
do you think it could make a significant difference modifying all my images to be power of 2?
Like is a 100x150 image more efficient compressed by scaling up to 256x256 and compressing it rather than leaving 100x150 alone?
A couple of things to note here:
-
You have both the Texture and Texture Atlas for a Sprite. You only need the the Texture Atlas for the Sprite so the Texture asset can be deleted. So right now, you are downloading and using VRAM for an unneeded duplicate.
-
You have one Texture Atlas per Sprite. While you can do this, it is recommended to pack Sprites into a single atlas. This gives a couple of advantages, much fewer network requests so potentially quicker download times and you can have the Texture Atlas as a power of 2 to compress. See Using Texture Packers | Learn PlayCanvas
-
I took a 346 x 101 texture. Uncompressed, it uses 140KB VRAM. When made into a 512 x 128 and used Basis, it uses 87.4KB VRAM
-
Yes.
-
Depends on what you do for loading/unloading but one per scene sounds sensible. Maybe a common texture atlas too.
-
-
You need to unload assets (textures) to free up VRAM
-
Smaller in dimensions textures, less textures, load only what you need and unload what you donât. Thereâs not really much else unfortunately.
78MB VRAM shouldnât crash iOS either
As this is in a WebView, maybe thereâs something in the application code of the native app that can allow you to have more memory?
Okay cool so for #4 what does that mean if im using an entity with a sprite renderer. Would deleting the entity or sprite component unload that (or the sprite from the sprite component), or do i have to in code manually unload it?
And yeah i have not seen it get past 80MB, In the most complex scene draw calls are about 105 per frame, could that be related?
And yes its a single view ios app with a WebView. I can look into that as well
you can experience it yourself by logging in really quuick in safari mobile and clicking âCapture The Flagâ
I profiled it in xcode, which can get RAM usage but not VRAM and it seems to be peaking like 19MB for the whole application, and CPU peaking at 18% (avg 5%)
No, you will also need to access the Sprite and Texture Atlas assets and unload them via https://developer.playcanvas.com/en/api/pc.Asset.html#event:unload
A small example can be found here for scene loading but same process: https://developer.playcanvas.com/en/user-manual/packs/loading-scenes/#managing-assets-in-scenes
Draw calls shouldnât matter.
I donât understand why loading really quick would crash it? Maybe you have a different issue that is dependent on timings/race conditions? Do you have an errors or logs in the devtools console when that happens?
Okay, yeah if you are not concerned with VRAM or draw calls maybe its not performance but something else. We have Raygun configured for Playcanvas, so all in game issues are reported, but not xcode errors for our app (i dont think a browser crash is a webview error, there are no logs in xcode for that event)
Are there any events you are aware of in playcanvas that would cause the browser to crash and restart? We are not getting reports from schools (our users) that desktops are doing this, only ios
Iâve never seen PlayCanva outright crash unless the tab runs out of memory. If the tab is crashing, than Raygun wonât help as itâs part of the browser tab 
One random thing to try is to disable device pixel ratio to see if that makes any difference.
Also, just to verify, what do you mean by âcrashingâ?
Okay i will try that and report back - Crashing meaning the webview crashes and reloads the page in ios
Yeah, that sounds like a memory crash in the tab
I did test out a tab and the chrome task manager says â1.8GBâ memory footprint, so i think its more likely that then a bug. Im going to compress all my audio and images i think.
Did track down the actual crash log in ios but having issues debugging it
023-03-21 11:03:06.276531-0400 BlueStreak Math Relaunch[7423:527865] [Process] 0x1120009d0 - [PID=7427] WebProcessProxy::didClose: (web process 0 crash)
2023-03-21 11:03:06.277779-0400 BlueStreak Math Relaunch[7423:527865] [Process] 0x1120009d0 - [PID=7427] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
2023-03-21 11:03:06.279488-0400 BlueStreak Math Relaunch[7423:527865] [ProcessSuspension] 0x11101c1e0 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID 0 is invalid
2023-03-21 11:03:06.281588-0400 BlueStreak Math Relaunch[7423:528005] [ProcessSuspension] 0x11101c1e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=0, error: (null)
2023-03-21 11:03:06.283667-0400 BlueStreak Math Relaunch[7423:527865] [Process] 0x104026418 - [pageProxyID=6, webPageID=7, PID=7427] WebPageProxy::processDidTerminate: (pid 7427), reason=Crash
2023-03-21 11:03:06.291722-0400 BlueStreak Math Relaunch[7423:528005] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2023-03-21 11:03:06.291853-0400 BlueStreak Math Relaunch[7423:528005] [ProcessSuspension] 0x11101c240 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=7427, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2023-03-21 11:03:06.317065-0400 BlueStreak Math Relaunch[7423:527865] [Loading] 0x104026418 - [pageProxyID=6, webPageID=7, PID=7427] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
2023-03-21 11:03:06.364931-0400 BlueStreak Math Relaunch[7423:527865] [Process] 0x1110647a0 - GPUProcessProxy::gpuProcessExited: reason=IdleExit
2023-03-21 11:03:06.365208-0400 BlueStreak Math Relaunch[7423:527865] [Process] 0x112001300 - [PID=0] WebProcessProxy::gpuProcessExited: reason=IdleExit
Let me know if you can make any sense of this
Up to the login screen (I canât sign in any more), itâs using 50MB of system memory
Does a published build of this crash on a cold start or is it over several sessions of the game, going between your native app and the webview game?
This is currently at the stage where I start ripping out features like all audio and seeing what happens
Cold start crashes it,
What is too many MB for RAM in your opinion?
I guess i will compress the Audio and Images and see what happens
100MB-150MB of VRAM. Iâve not yet heard of a case of running out of Application memory being a consistent cause yet.
1 Like