GBear Posted January 24, 2016 Share Posted January 24, 2016 hi.. i'm worrying about memory because ios has low memory(1GB under 6s) pc and android is good to play my game but ios is crashed i'm thinking because of memory and safari's bad memory controlling(safari is not good for webgl. T_T how do you think about this?) so i'm trying to reduce memory.. first. how can i release resources after 'load'? maybe it doesn't need after loading so i wanna release clearly. if you have any idea to control memory efficiently please give me idea to tip.. to anything ^^. thx.. Quote Link to comment Share on other sites More sharing options...
xerver Posted January 24, 2016 Share Posted January 24, 2016 When you have completed use of a pixi object, call the destroy() method. Different destroy methods can have extra params so make sure to read the docs for each one you need. You can also clear the loader's cached assets by doing PIXI.loader.reset(); Quote Link to comment Share on other sites More sharing options...
GBear Posted January 24, 2016 Author Share Posted January 24, 2016 thx @xerver can I remove each resource ? PIXI.loader.reset is all clear at once.. but i wanna control more detail ... thx.. Quote Link to comment Share on other sites More sharing options...
xerver Posted January 25, 2016 Share Posted January 25, 2016 So to be clear, PIXI.loader.reset() does *not* destroy those resources, it just makes the loader not hold a reference to them anymore. You can easily manage it yourself after loading: var cache; PIXI.loader.add('res', 'resource.png').load(function (loader, resources) { cache = resources; PIXI.loader.reset(); // loader no longer holds onto resources, but does not destroy them // later, when you're done with 1 resource cache.res.texture.destroy(); // destroy the pixi object delete cache.res; // remove our reference to the resource so it is garbage collected }); Hope that helps. Quote Link to comment Share on other sites More sharing options...
GBear Posted January 25, 2016 Author Share Posted January 25, 2016 res.texture seems like basetexture.. and destroy called manually when basetexture using done ? I didn't use destory yet.. and at this time gpu memory is continuously big more and more... is it right? thx.. Quote Link to comment Share on other sites More sharing options...
xerver Posted January 25, 2016 Share Posted January 25, 2016 Correct, when you are done with any pixi object make sure to call destroy() on it, and look up the docs for that object's destroy method to ensure you use it properly. Quote Link to comment Share on other sites More sharing options...
GBear Posted January 27, 2016 Author Share Posted January 27, 2016 thx ..^^/ @xerver 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.