[r206/r207] RAM doesn't lower after destory

Bugs will be moved here once resolved.

Post » Thu Jun 18, 2015 7:48 pm

Hello Ashley,
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!

Problem Description
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
  • Run project
  • Open Task Manager and sort by Name to stop the processes from moving around and keep all processes staying together
  • Look at the RAM values on Task Manager. Rather low and nice.
  • On the project, tap Space to start spawning a lot of sprites, KEEP an eye on the RAM of the processes on Task Manager.
  • Let the RAM build up a few extra 10's, maybe til the one that is rising reaches about 60 or 70 MB (Around 20000 sprites).
  • Tap Space again to delete all the sprites and stop them creating.
  • Look at the RAM. It does not go back down and remains at 60/70MB or whatever you tapped space at.

Observed Result
RAM usage stays high

Expected Result
RAM should go back down I think

Affected Browsers
  • Chrome: (YES)

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!
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Thu Jun 18, 2015 8:09 pm

this is the expected behavior i believe as the object is stored in ram til the next layout if you create it.
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Fri Jun 19, 2015 2:15 pm

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.
Scirra Founder
B
397
S
236
G
88
Posts: 24,423
Reputation: 194,560

Post » Fri Jun 19, 2015 2:25 pm

@Ashley
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.
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Fri Jun 19, 2015 3:38 pm

@Jase00 - if Chrome is using up memory without ever releasing it, that is a Chrome bug, not a Construct 2 bug.
Scirra Founder
B
397
S
236
G
88
Posts: 24,423
Reputation: 194,560


Return to Closed bugs

Who is online

Users browsing this forum: SamRock and 2 guests