How do I spot and avoid memory leak?

I have problem in my game, the server memory slowly increase by the time and reach to a very insane amount of memory it can reach up to 6.2gb but I don’t know how to spot and stop memory leak

I have read this post

But I did not understand it

this is a picture for F9 (server side)

2 Likes

To find the source, one method I like to use is disabling everything one by one until it stops happening. Once you find the source, look for any kind of variables or connections that might not be getting cleaned up.

3 Likes

Thanks for the note I will try it, the problem is its happening by the time so I don’t know how I will be able to know

1 Like

How you gonna know that when it need like 30 mins+ to get the amount of memory? I can’t just disable all and wait 30 min for each script to check it out if it happens or no

In that case, you might want to see what actions causes it to happen. If it just happens over time while you do nothing, then it comes from code that is running independent from player input. Try to narrow it down based on what triggers it.

3 Likes

image
I kept respawning myself very fast I don’t know if its normal but I believe it has something to do when respawning…

I have a question, would the guns effect memory if they were in starter GUI inside buttons?

No? Memory leaks are mostly caused by code.