Opened 10 years ago
Closed 10 years ago
#2808 closed defect (fixed)
Out of memory / possible leaks
Reported by: | historic_bruno | Owned by: | |
---|---|---|---|
Priority: | Release Blocker | Milestone: | Alpha 17 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
Basically every Windows player crashed in our multiplayer games today, due to running out of memory, but this is more likely about 32-bit address space than the OS being the problem. Memory usage creeps up in the lobby by 1MB/s at times.
Attachments (7)
Change History (14)
comment:1 by , 10 years ago
by , 10 years ago
Attachment: | crashlog.rar added |
---|
comment:3 by , 10 years ago
The main problem doesn't seem to be related to GC. Today after playing a long multiplayer game, memory usage of pyrogenesis was at 1.2 GB on the main menu. It looks like there are really some memory leaks.
I've used valgrind with the following command to get information about memory leaks: valgrind --smc-check=all-non-file --track-origins=yes --show-leak-kinds=definite --leak-check=full ./pyrogenesis 2> memory_leaks.log
I've started a short singleplayer game on the Acropolis default map against 1 AI. It was quite short because the performance was terrible with the memchecking enabled (<1FPS). The log is attached. I'm not used to analyzing this output, so I don't know what yet if these are real memory leaks or false positives.
by , 10 years ago
Attachment: | memory_leaks.log added |
---|
comment:4 by , 10 years ago
It may not truly be a "leak" if it gets freed before the game shuts down. You could try using a memory analysis tool to see what is allocating memory, how much and when. I'm doing something like that on Windows for #2735.
by , 10 years ago
Attachment: | valgrind_mempool.diff added |
---|
wip, still some remaining issues, but a lot cleaner output
by , 10 years ago
Attachment: | massif_output_1v1_singleplayer.txt added |
---|
comment:5 by , 10 years ago
- The VFS uses a cache size of 500 MiB on my system which is the maximum value (check ChooseCacheSize in GameSetup.cpp). For the replay mode, the size is hard-coded to 20 MiB. Apparently this cache is also used for textures, so I expect the whole cache to be used up quite easily.
- SpiderMonkey does not de-commit memory (give it back to the OS) in the current setup, it just marks it as "free" internally during GC. This generally means that after a long game, the runtime size will be close to the maximum of 384 MB and will not go down anymore. I've added a patch that enables very aggressive (frequent) Shrinking GCs for testing purpose.
So if we add only these two causes, we get around 900 MB, which is already quite close to the 1.2 GB I observed in the lobby after the first match.
by , 10 years ago
Attachment: | ShrinkingGCHack.diff added |
---|
A hack that calls very frequent shrinking GCs for testing
by , 10 years ago
Attachment: | GC_Scheduling_PATCH2_WIP_v1.diff added |
---|
An attempt to prevent situations where SpiderMonkey needs to trigger GC because it's low on memory. (for testing)
comment:7 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is greatly improved, people aren't reporting OOM errors like they were. In general, the game's memory use needs to be carefully examined (for fragmentation and unnecessary allocs), but this one issue was more about SpiderMonkey's GC and the cache size, which Yves addressed. We didn't find any memory leaks of note.
I have a full memory dump available if it helps, it is about ~300 MB compressed.