Page 1 of 1

Massive memory leak in MT 5.0.0?

Posted: Tue Mar 12, 2019 07:40
by Wuzzy
(I wrote this in the News thread, but I repeat it here so it's more visible:)

I believe I noticed a massive memory leak in Minetest 5.0.0 while developing MineClone 2.
If I keep running Minetest for a while and explore the world, it eventually eats up all my ~8 gigs of memory at an alarming rate.
This never happened to me in previous versions.

When I quit the world, only some memory seems to be freed. Sooner or later my memory is full and I have to close Minetest. That problem killed my system multiple times in the last days.

The same seems to happen with MTG, the memory consumption also grows and grows, although not that fast.

Did anyone else notice extreme memory consumption? Might this be a regression?

Re: Massive memory leak in MT 5.0.0?

Posted: Tue Mar 12, 2019 09:41
by Linuxdirk
Wuzzy wrote:Did anyone else notice extreme memory consumption? Might this be a regression?
Not personally, but currently I'm on this issue with one of my mods: https://gitlab.com/4w/mtimer/issues/7

During testing added print(collectgarbage("count")) to a globalstep construct that runs every second and the value rised for some seconds and then is reduced and rises again and is reduced again but to a higher value it was reduced before. This continuesd during testing but may trigger an OOM exception like H4mlet explires with Windows 7.


Edit: Found the issue and it is unrelated to potential memory leaks and maybe was actual memory usage gone crazy on Windows. So no, I did not notice any extreme memory consumption..

Re: Massive memory leak in MT 5.0.0?

Posted: Tue Mar 12, 2019 12:58
by jas
nope

Re: Massive memory leak in MT 5.0.0?

Posted: Tue Mar 12, 2019 21:59
by sofar
Quit message received.
AL lib: (WW) ReleaseALBuffers: (0x6b08ac0) Deleted 135 Buffers
==15368==
==15368== HEAP SUMMARY:
==15368== in use at exit: 316,355 bytes in 3,350 blocks
==15368== total heap usage: 1,267,313 allocs, 1,263,963 frees, 3,223,400,122 bytes allocated
==15368==
==15368== LEAK SUMMARY:
==15368== definitely lost: 2,456 bytes in 20 blocks
==15368== indirectly lost: 6,068 bytes in 138 blocks
==15368== possibly lost: 0 bytes in 0 blocks
==15368== still reachable: 307,831 bytes in 3,192 blocks
==15368== suppressed: 0 bytes in 0 blocks
==15368== Rerun with --leak-check=full to see details of leaked memory
==15368==
==15368== For counts of detected and suppressed errors, rerun with: -v
==15368== Use --track-origins=yes to see where uninitialised values come from
==15368== ERROR SUMMARY: 69036 errors from 56 contexts (suppressed: 0 from 0)
This is the output from a valgrind run where I actually connected to a server, using the UI, then disconnected.

It appears that any memory leaks are reasonably small. I didn't play for a long time, but 2k bytes lost is tiny compared to the amount of memory allocated and not a major concern. More data would be better, of course, but running under valgrind is expensive and (unplayably) slow.

Re: Massive memory leak in MT 5.0.0?

Posted: Mon Sep 23, 2019 12:35
by Wuzzy
I still have this issue in v5.0.1, and v5.1.0-dev (updated like a week ago).
It does not seem to matter which game I play, it's probably all games? Memory is still eaten up at an alarming rate.

I noticed that the memory consumption goes up the fastest when I fly around the world, forcing the mapgen to generate the map. And yes, memory consumption is still not going down after quitting the world.

There seem to be other people claiming a memory leak as well:

viewtopic.php?f=6&t=22882&p=352106
viewtopic.php?f=6&t=22868&p=351914

I think I should probably post this on the bugtracker. This isn't normal.

EDIT: https://github.com/minetest/minetest/issues/8977