My game is dying (Memory Leak?)

Hi guys, I’m having a pretty frustrating problem with my game. He’s just dying on weaker cell phones and computers. I’ve been doing some research and it looks like I have a memory problem. My game has been consuming a lot of memory and the weaker cell phones and computers are not able to run it.

I also wanted to understand the difference between Place Memory and Core Memory, because when I enter the game they start low, but when I walk through the game they go up and never go down.

If you want to take a look at the game it’s called BloxyTopia RP, thank you.

Hey iBoguo,

Concerning Place Memory vs. Core Memory: if you go to the “Developer Console” page on Roblox’s Developer site, you will see a section titled “Memory”. I’m going to copy and paste some information from there into here:

Memory

Models, terrain, parts, visual effects, scripts, physical contraptions, audio, and more can all contribute to total memory usage. The Memory section of the console displays metrics on memory usage.

Within the view, the total memory is separated into three categories:

  • CoreMemory — Memory used by processes built into the Roblox engine such as networking, avatars, GUI elements, etc.
  • PlaceMemory — Memory that scales as a direct result of choices made as an experience is built.
  • UntrackedMemory — Arbitrary memory allocations that are not tagged.
  • PlaceScriptMemory — Memory used by user Luau script threads; this section includes script names and custom memory tags.
  • CoreScriptMemory — Memory used by internal Roblox script threads.

Now, in terms of fixing your problem: the fact that you said it only lags on lower end devices makes me think it’s probably a client side issue that is causing the lag. If your server was the source of lag, all users would have that same lag.

FYI: Memory leaks are generally when things like parts or script data gets created and never deleted (and are normally lost track of.) It is a possibility that is happening in one of your scripts, but I would only think that if your memory constantly went up.

Your problem might simply be having too many parts. If that is the case, it could just be too many things for the device’s memory to handle, or just too many objects to render onto the screen. (If it’s just too many parts to render, a mobile user’s performance stats would show trouble signs - under GPU most likely?)

To help with this issue, I would first try enabling Streaming Enabled. I would read up on that before enabling it to understand the small caveats with that, such as potential (but brief) player pauses during the game when entering a new area of the game. However, if items just too many parts loaded into your game, this is a great solution. Otherwise, if Streaming Enabled won’t work for your game, you could try deleting some parts you don’t need out of the game.

If THAT does not work, then I would start looking into the memory leak idea. (If it’s truly a memory leak, even higher end devices would get laggy eventually, although it make take a longer amount of time.) You would check your scripts to see what the potential source of a memory leak would be.

I hope this helps you locate and fix your problem!

4 Likes