Will disconnecting RBXScriptConnection function in server scripts when they are no longer needed improve server performence?

I wanted to ask this before I go out of my way to do it if I disconnect functions connected with a RBXScriptConnection when they are no longer needed will it improve server performance?

1 Like

In general, no.

The amount of memory a single connection instance takes up is less than a kilobyte, whereas servers store multiple gigabytes of memory.

A bunch of connections just existing doesn’t slow down the server on its own. It only becomes a problem when you have a memory leak from creating new connections without disconnecting the old ones, or if you connect a slow function that takes several milliseconds to run to an event in RunService.

For example, if you’re running code at 60FPS, that means you have a maximum of 33ms per frame to do everything, so if you add a new RunService connection that takes over 5ms to run, then you’ll likely see some visual impact to performance. Notice how this is an issue with code runtime rather than memory management.

1 Like