I've probably made around 5-10 threads total over frustration of not getting to complete grasp over how construct 2's memory works (Don't redirect me to the memory use blog please, I know the basics...). So I've documented how the memory use constantly rise as I'm playing through my game. I'm hoping someone can see what's going on, and give me some insight. I'm running the game in Node Webkit 32-bit.
There's three processes running at once: One that never takes more than 15-30mb, one that keeps rising to infinity
, and one last that seems to actually be dynamically discarding the assets it doesn't need. I'm getting more and more frustrated with this process that keeps growing. Why is this happening? I've provided images documenting the playthrough and the memory use.
1. The title screen and first stage of the game. By default the stage takes around just shy of 800mb, and the other process takes 1gb. While excessive. i'm cool with this as long as the memory use doesn't exceed this. It runs really smooth even on older computers.
2.Next stage takes slightly less memory on the third process. Not as many heavy assets here, though process 2 has risen almost 300mb.
3. I make it to the demo's main event. It only takes around 400MB, but the second process has risen again...
4. At the end of the demo. I use some heavy "look at the shiny stuff" kind of assets here, so the memory use is slightly bigger here than the previous level. The second process keeps rising.
5. The end of the demo. This stage is just 1 big image, and the third process reflects this. Only a 100mb, that's nothing. However it's here I started figuring out the second process never clears its memory. It's the same 1.6 gb!
6.I return back to the title screen. The memory use on the third is very close to the first image, but the third still takes 1.6 due to playing through the demo.
7. Just to play around further I load one of the biggest layouts in the game. It adds another almost 200mb to the second process
8. Again I load another layout, by far the most heavy. I've peaked 2gb on the second process...
9. Aaaand the title screen takes 2gb now...
This is gonna become a huge problem down the line. I'm severely limited on how I make my content due to this. The ram usage just keeps growing. Like a garbage collector that doesn't do its job! Any tips on how to clear this memory every once in a while? If this tumor of a process can't reduce its size every once in a while I will eventually hit a wall... I'm already reusing tons of assets between every stage, but I still see myself having issues with memory. The only theory I have as to why this happens, is that I introduce new music and sfx on every stage. I read this is never unloaded?
Any tips is appreciated. I'm becoming somewhat desperate here...