I have been having bad problems with C2 in my project. I have been having crashes on my computer from lack of RAM due to this, and on 3 occasions I have lost work (Not too bad though, I make backups like crazy). I have replicated something that I hope you can resolve!
If you create many objects and delete them, the RAM usage of Node-webkit/Chrome, does not go back down.
Attach a Capx
https://dl.dropboxusercontent.com/u/776 ... yLeak.capx
Description of Capx
In this Capx, run it. You will see a blue box moving, that's there just to keep the engine flowing I guess, not too important.
If you tap space bar, it will toggle a value and cause about 9 sprites per tick to create. Tap space again to stop creating sprites and instantly delete them all.
Steps to Reproduce Bug
RAM usage stays high
RAM should go back down I think
Operating System and Service Pack
Windows 7 64bit
Construct 2 Version ID
r206, but I know its happening on 207. I had to uninstall 207 as it broke something with the Paster plugin I was using and also created a weird smear effect when going fullscreen. I need to replicate the smear thing but it wasn't as urgent as this RAM bug.
I hope you can help. Thank you for your time, much appreciated!
this is the expected behavior i believe as the object is stored in ram til the next layout if you create it.
Develop games in your browser. Powerful, performant & highly capable.
Closing as not a bug. Browsers use garbage-collected memory, so they do not immediately release resources, only when they collect garbage. So you should not expect destroying objects to immediately release anything. If you have a lot of spare memory, e.g. 4 GB RAM with 2 GB free, and the browser is only using 100mb, it may quite reasonably decide there's no point wasting CPU time running garbage collection. If it does start to run out of memory it will then collect garbage to free up memory, preventing any crashes related to running out of memory due to uncollected garbage.
You can verify this is the case: create 100mb worth of objects, destroy them, open Chrome's dev tools, go to the Timeline tab, and click "collect garbage". The memory use instantly drops down to ~30mb.
If you experience any crashes it is very unlikely to be caused by this, so you need to find what the real cause is and report a bug based on that.
Ah I see.
Well I'm getting crashes due to the garbage collection not running I presume. If I'm working on C2 with the preview project sort of floating in the background, after a few minutes, I will get a windows message warning me about low RAM (I have 6gb), and if I leave it for about 20 more seconds, my computer crashes to black. I monitored this a few times, the only thing happening is Chrome/NW just keeps getting bigger and bigger.
Could there be a "Force garbage collection" action? I wouldn't mind eating CPU at certain intervals to prevent crashing my PC whilst working!
EDIT: I'm realising how dumb my situation sounds due to this capx. The actual reason it's affecting my main project is particle related stuff, objects getting created and destroyed frequently. Ramps up my RAM whilst I'm working.
Jase00 - if Chrome is using up memory without ever releasing it, that is a Chrome bug, not a Construct 2 bug.