/ home / Documentation / v3 / mediasoup / Garbage Collection

Garbage Collection

Due to its design, the Node.js application is responsible of creating and managing mediasoup objects such as workers, routers, transports, producers and consumers. In summary this means that the application must keep references to those objects, call methods on them, listen for events on them and remove those references when the corresponding object has been closed.

Closure Actions and Events

The mediasoup API describes all those actions and events. Here just a summary of them.

A Worker is closed when:

A Router is closed when:

A Transport is closed when:

A Producer is closed when:

A Consumer is closed when:

A DataProducer is closed when:

A DataConsumer is closed when:

A RtpObserver is closed when:

When any of these close() methods is called or “xxxxxclose” event is emitted, the corresponding mediasoup object becomes “closed” (its closed property is true from now on) and the application should clean the reference to that object.