Memory leaks problem - Quick Help Please!

Hello developers, I’ve been having the same wait-a-few-mins → lag increases → freeze in my games. I’ve figured out two potential issues, however, I’m not sure which one it is. This is also my script window, and honestly customparts is just a script that loads several other functional modules, eg: for Spleef, for KillParts, for MovableParts, etc. It is the one with the extremely high Rate/s in the image:

I’ve been told numerous other times that Rate is not directly linked towards memory leaks… infact script activity matters much more. Thus, I went towards finding some other issues, and it could also be due to the number of UNIONS present in the game. Does that matter?
I’d be really glad if someone could provide me with some insight on this.

1 Like

number doesnt matter, really, BUT the union operations becoming more and more expensive.
for example if you use like 50 union operation on 1 part, it will make your game suffer.

You also could check for

  1. Connecting Events inside Loops
  2. Events inside Events

A simple way to check if it’s the unions is just to remove them and check if the problem still happens.

It’s weird to have such an insane amount being used in “customparts”, are you doing union operations live? Maybe it could also be from streaming enabled streaming in and out unions? (Though at that point your unions are probably too crazy already.)

1 Like

Script rate, activity, and number of unions are unusable to determine a memory leak and are irrelevant garbage data, whoever told you this not only was unhelpful but harmful.

First, open studio and run the game locally. Open the memory profiler and determine what category is growing over a period of exactly one hour. Give me your metrics, take note of all script activity and all memory categories, and report back to me all information, not just the one category that is growing, when you can.

Thank you for the insight… are they really that garbage though in determining memory leaks? So I should not be worried of the insanely high rate of that script in the image?

Sure, I will do that. Please check on this post when I ping you…

High rate scripts can literally be anything, like animating parts continuously.

This doesn’t need to be a memory leak. Memory leak is when unused objects/data does not get cleaned up or when they not get reused and get created each time something is used.

This problem you mentioned can also be a bad programming practise which causes lag like overusing some physics events/setting some of the “laggier” properties too frequently. It’s not possible to know without seeing the code.