fateriddle Posted November 9, 2018 Share Posted November 9, 2018 Using on phone, if need to leave chrome app then go back, what should I do to keep memory low? Like I don't think I can dispose everything one second, then when user comes back to web browser app, then I immediately create and import everything on the fly. What should I normally do? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 11, 2018 Share Posted November 11, 2018 Hiya Fateriddle. umm... I'm not experienced with this AT ALL, but... when you "let" the phone OS... manage the memory and threads, are you seeing bad things? When you leave the browser with a BJS scene, then come back, does the scene break/look-bad, in some way? To be frank, I'm not sure if you SHOULD try to intervene/mess-with the phone OS memory/thread management. The phone might ALREADY close-down the HTML canvas as best it can (when leaving browser app) - lowering priorities for the browser's processes. I doubt that scene.onDispose is triggered when browser app is departed. But, maybe. Nah, probably not. Can you get an event of ANY kind... in the phone's scene JS, when user leaves the browser? Perhaps you cannot even DETERMINE if/when the user is leaving the browser app. So, maybe there is no chance for you to do imaginary things like scene.quitRendering() or scene.idleAndCache().... before the user leaves. And maybe there is no triggered DOM event when user returns to browser, so you have no chance to do scene.wakeFromIdleAndCache(). Those are all just made-up function names for a system of "manage your own idled scene". It doesn't exist... but I'm thinking about stuff. Only 3 months ago, I got my first mobile, a refurbed iPad 4 with a Safari browser. I started testing a thumb-driven version of my flyer thing - a playground demo. I, too, was surprised to see it "still loaded" after I left Safari, and then came back. I immediately thought about resources-recovery during idling time... just like you are thinking. But my scene always looks good when I return, and I'm getting no low-memory warnings. Oh well, I was of NO HELP here, but at least the topic is bumped. Let's ping @Deltakosh (others welcome, too)... to see if we can learn WHAT happens to a BJS scene when we leave the mobile browser. Is the BJS scene put into maximum-idle, somehow? Curious minds want to know. And maybe, each brand of mobile OS... does it differently. Learning the details... might take some DEEP research into device manufacturer websites. (yech!) Help/info welcome, from anyone. Thx! Hey fateriddle, have you checked/installed any "memory watcher" apps for that phone? I wonder if we can "see" what the phone does with a back-grounded webGL scene... via watching graphs/numbers on the phone itself. hmm. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 12, 2018 Share Posted November 12, 2018 Hello! we do have an option to make sure the engine enters idle mode in this case: engine.renderEvenInBackground = false Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.