Developing Apama Applications > Developing Apama Applications in EPL > Working with Streams and Stream Queries > Defining streams > Terminating streams
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 steams.
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.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.