Lifetime of anonymous objects in javascript

I have an autonomous socket.io based class object which accepts an array of server side sockets, and then just listens for the clients messages and emits responses back to the clients. To run this functionality I just need to create an instance of this object by calling the following function, like this:

function CreateNetworkGame(clients) {
    new NetworkManager(clients);
}

I know, this not a good practice, but it works and just in the name of the science I want to ask: No variable keeps reference to the object's instance, so why it is not garbage collected and when will it be (if ever)?

Generally, listening on a socket will keep the listener alive. The listener function/closure/object likely encloses references to related objects, potentially up to the NetworkManager itself.

This way the part of the object structure that is actually required for processing network events is guaranteed to stay alive until the listeners are unregistered. However, it is possible that the top-level NetworkManager instance is not part of it, and gets indeed garbage collected very quickly.

the instance registers itself with another object. therefore it is referenced and will not be garbage collected. this is a typical scenario when using event listeners.