How do I fix memory leaks... again?

I can’t really seem to understand the guides that people are sending in these threads, if you could explain them in layman’s terms that’d be great!

Here’s my problem, client LuaHeap memory is steadily increasing over time. It starts at around 60 and so far has gone up to 70

Picture Proof:

Any help is appreciated, Thank you for reading!

Another quick question:
I’ve heard that Lua garbage collects by itself, so I’m confused who’s fault it is, mine or ROBLOX’s?

2 Likes

A lot of the time, at least for me, this happens when I forget to add a wait within a while loop. If you use any while loops in your scripts, check if you missed a wait somewhere. Other than that, I’m not fully sure - I’m not that much of a scripter.

2 Likes

Not using any while loops in my main script.
image

2 Likes

Hm, could you show script activity? Which script is having the most activity? They should ideally be only having an activity of 2% or lower imo. Unless they’re loops possibly.

3 Likes

Just want to ask, where would I find this?

2 Likes


Found this, seems to be floating around 0.2mb of RAM.

2 Likes

It’s on the view tab of studio I think, there should be an option called script activity then. You’d see it easily.

1 Like

I’m pretty sure it’d be the post above then, after the deleted post.

1 Like

did you forgot to deallocate any arrays?
did you forget to cleanup after unsed instances?
are you disconnecting your events properly?

1 Like

How would I deallocate an array?

1 Like

you set the variable referencing the array to nil

1 Like

Oh, well in that case I’m good!

But, just in case, I’ve made every table (when it’s unused) nil! Thanks for the advice :))

1 Like

Overall game memory is steadily fluctuating between 1000 - 1010mb, which is a good sign to me. Thanks for all the help guys!

1 Like

Must be connections not being disconnected. Check your games for connections inside for loops or in functions that are called multiple times, those connections need to be disconnected because it causes memory to build up as they get called over time.

1 Like

I’ve made sure to do that, most if not all connections are managed and disconnected appropriately.

1 Like

I would recommend using janitor for such occasions… it’s worth learning

2 Likes

Thanks! I’ll definitely check it out at some point.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.