Untracked memory becoming major source of game's memory leak issue

I wish to lower memory leaks to the lowest possible amount.
Starting a few days ago, untracked memory has become the largest percentage of total memory usage on the server. About 70% worth. This server was 5-6 hours old, so if the untracked memory was way less, it would be acceptable to be around 700-800mb.

I have taken several weeks worth of experimenting with the brilliant insight from this thread, to do the things that have been laid out.

Now untracked is the worst problem. Is this my problem or is this happening to anyone else recently?
Anyone have any more ideas into what isn’t included in the other memory counts, to infer what untracked is?

8 Likes

Even if the memory is high, are you experiencing freezes, crashes, unnaturally high amounts of lag?

Having untracked memory high is not something developers can do much about, as it is generally internal systems. The memory console tracks any memory which could be useful to developers, leading me to believe this isn’t something we can change.

Found that many server scripts in my game are having huge rate/ sec after the game goes on for hours, might be some memory leaks? I may update the thread again if fixing these helps

Anyone know for sure if Rate (/s) is some kind of memory leak per second indicator?

Well, it could be, or could not be. You should try looking in your script(s) to see what’s causing the issue, but if you can’t find anything, you could try posting the script here and someone would hopefully help you to try and find the source of the issue.

This appears to be a bug. I’ve experienced it on my projects, the rate just continues to go up infinitely. Though it appears to have zero effect on the game.

2 Likes

Yes, I’ve tried running an empty baseplate with a single player and the untracked memory is reported as quite high, suggesting that it is a bug.

However, just to make sure, have a look at this:

This is a common problem that causes pretty annoying leaks.

A little late but it might be MEMORY LEAK: Player connections are not disconnected on player leave

If you are doing things on any player event then you are building up garbage

A temporary fix until Roblox actually patches it could be to store all of the connections to Player signals in a table and disconnect them all when the player leaves the game (basically a maid that cleans on player removing)

I took a look at the code you used in that example, and it seems you keep a reference to the player’s character (and therefore the player themself) in an upvalue array. This is what stopped it being removed. Objects are only garbage collected after all references are destroyed.

Take a look at the article I posted above to see why. The upvalue reference does not have to be a direct one.

Also, just so that you know, a staff member has merged to topic. This usually means that the behaviour you pointed out is not a bug.