Terminating streams
If a stream goes out of scope, it continues to exist until the monitor instance terminates or the stream is explicitly terminated in some fashion. Streams are not garbage-collected. This means it is possible to leak streams, thereby consuming memory and potentially performing unnecessary computation, if you do not explicitly terminate streams.
To terminate a stream, call the quit() method on a stream variable that refers to the stream you want to terminate. For example:
stream<integer> foo := all A();
...
foo.quit();
This might also terminate connected streams. See
Stream network lifetime. It is also possible to terminate connected streams by quitting a stream listener.