Open thrzl opened 2 months ago
The tab "World" contains a smaller globe which is also draggable. Thus I tried going back and forth between that tab and and "Plan", as that's faster than advancing and can be repeated more often. I am aware it might be totally unrelated. However, I did also observe a significant memory increase from advancing a cycle.
Here are my observations from the f12 console:
The small jumps are from individual back-and-forth. The jump from 42MB to 75MB at 01:49:06 is from advancing a cycle. The last and biggest jump is after me doing a lot of back-and-forth to try and see the line go up in task manager, which it did.
Before advancing a cycle, during, and after. The memory goes down, but not to the original value.
Additionally, I tried just waiting, jumping back and forth between "Plan" and the other tabs, and between the other tabs and "World". All jumps seem to increase the size of memory, but jumps back and forth involving "World" produce by far the largest increase. Advancing a cycle always also increases the size of the snapshot. Reloading the tab and continuing with the save brings the size back to something probably normal.
I'm aware it might be much more complex than this. Also, probably the jumping back and forth between tabs is probably not entirely related and possibly a separate memory leak.
My issues are much more drastic; after 2-3 cycles I couldn’t even refresh the page anymore (which i usually do to clear the memory) and upon checking usage I discovered that it was at 9GB.
Huh, that's strange. So far I can't replicate it on Firefox or Chrome on my Linux machine (OpenSUSE Tumbleweed). I do see higher memory usage in Chrome but it looks like it evens out.
I tried a few things and it looks like it's the Hector model that is the largest contributor to the memory footprint. On Firefox the starting memory usage is around 20MB, after a cycle it's around 65MB. If I take out Hector it's only about 21MB after a cycle, so I don't think it's the globe in this case.
I'll keep investigating and see if I can figure out what's going on.
After more testing I'm not sure that Hector could be the cause of your leak. I had already made it so that Hector initializes only one time and my profiles do show that it contributes only to a one-time growth in memory use. At 9GB it could be something unrelated.
But for now I've added two debug flags that will disable the globe and/or hector during the world phase of the game:
https://play.half.earth?debug=no-globe https://play.half.earth?debug=no-hector
Or both simultaneously: https://play.half.earth?debug=no-globe,no-hector
When you get the chance could you try the game out with each of these flags and see if it helps?
On M2 Mac w/ Orion: With Globe & Hector Enabled, on the 2-3rd cycle the game tab froze after pressing the ready button and my browser's memory usage increased to around 11GB, and then the game failed to load the globe. Memory usage increased to about 1GB at the start of each year in the cycle, and then declined again. Notably, no memory spikes happened before this.
With Globe disabled, everything works fine, and when viewing the globe in the "World" tab memory usage does go up a little, as sgitkene said, but not as badly as what I was initially describing.
Haven't tried no-hector yet, I'll likely try it tomorrow.
I’ve noticed the issue on a variety of browsers and devices, including:
It always seems to happen after a cycle, so my thought is it’s something with the planet render; however I haven’t done too deep a look into it yet.