RBXScriptConnections are freed while connected

I believe this a similar issue that affects Instances, although there I get the reasoning.

If you store an RBXScriptConnection in a weak table but dont create a strong reference at the same time, the connection is freed from the table even though its still connected.

This is an issue for me as I track connections in a weak table of sorts to track active connections assigned to different objects. I have my own workaround for this, but its strange behaviour nethertheless.

Expected behavior

A connection to remain unfreeable until its disconnected.

Workaround

My workaround involves creating a strong reference to the connection within the event, which I use to send the connection through to the handler.

This is not an issue.

Connections creating reference cycles that were uncollectable in the past, even when not referenced by anything strong externally, is actually a long standing bug in the engine causing many issues for many developers.

We will always be moving in a direction when such cycles will be successfully collected and freed, even if we might not be able to do that in all cases today.

3 Likes

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