Memory leaks?


  • I have been monitoring the server software as it runs and it is showing signs of memory issues. In general it appears there are memory leaks. larger maps run for more time will show theses problems. There is also question about scaling in code.

    Over time, if run on a larger map for long enough, the server will consume all of the RAM. I assume this may have already been reported, but in a quick browsing of the forum, I have not seen it reported.

    Also there is something odd about map loading, almost as if for each resource (map, items, etc) a full copy of the map is loaded. Even after compression is accounted for, the server takes up about three times the map file size for each entity set loaded.

    Also breaking the world file into chunks in the zip stream also helps. Say have world file, then in there have chunk files. When a single chunk is generated, flush it to file.

    Also instead of representing blocks as .net objects, it is a bit more efficient and memory save to have memory chunks where blocks are represented by bytes. You can then have block type byte, and for other items and properties, do something like how vertex data works in a GPU, have a 2nd list that contains additional data, and points to the specific record in the main chunk. This prevents additional objects from being created where they are not needed.

    I am not sure where the memory leaks are coming from, but I assume it is related to when players login to the server, and additional objects are loaded into memory.

    Overall the game is great, but there are some challenges working with .net and not having full control over chunk buffers, but i think with a little more attention on memory usage and chunk loading, it can be worked out.


  • 2
    Posts
    978
    Views
    Log in to reply


  • There are known memory leaks. This is mainly due to Unity's poor garbage clean up handling and it makes it hard to fix/fix these issues.

    The big memory leak is actually with the client and you will often need to recycle/restart the game every couple of hours. The garbage handlers are bad with teh client side leak and not all memory is being returned when the game is recycled/restarted/shutdown and this usually requires that the client hardware itself requires a shutdown/reboot.

    The server does have a memory leak but not to the extent secend on the server. Most servers do well with a daily recycle (server stopped and started again) and the memory freed that way. In the majority of the cases simply shutting the game off and starting it back up again was all that was needed to clear the memory - hardware did not need to be rebooted. At the most we have required to restart the hardware once in a week although certainly that can be monitored and would depend on the hardware and RAM available on a server.

    Pam
    Community Moderator
    Discord: Pam#5439
    reddit moderator: rentechd
    https://discord.gg/Mg4WJe9


2
Posts
978
Views
Log in to reply

Internal error.

Oops! Looks like something went wrong!