Developing Apama Applications > Developing Apama Applications in EPL > Testing and Tuning EPL > Avoiding listeners and monitor instances that never terminate
Avoiding listeners and monitor instances that never terminate
An Out of Memory condition causes the correlator to exit. This condition can be caused by listeners and monitor instances that never terminate — also referred to as listener leaks. For example, the following on statement defines event listeners that never terminate:
on all ( Foo(id=1) or all Foo(id=2) ) {      // second "all" is bogus
...
}
The following example spawns monitor instances that never terminate:
on all Trade():t spawn handle();         // missing "unmatched" action
...
action handle() {
   on all Trade(symbol=t.symbol):t {
      ...
   }
}
The sm (number of monitor instances) and ls (number of listeners) counts in the log file are often revealing in the case of a memory leak. An increasing trend can be seen in these counts over a period of time, when there is no valid reason for this given the intended logic of the application.
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.