Developing Apama Applications > Developing Apama Applications in EPL > Testing and Tuning EPL monitors > Best practices for writing EPL > Avoiding unnecessary allocations
Avoiding unnecessary allocations
You should eliminate unnecessary allocations, especially when the size of an event is very large. For example:
event LargeEventWith1000Fields {}     // field definitions omitted
 
integer i := 0;
while (i < 1000) {
   route LargeEvent(0,0,i, ...);      // bad
   i := i + 1;
}
 
LargeEvent le := new LargeEvent();    // good
while (i < 1000) {
   le.foo := i;
   route le;
   i := i + 1;
}
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.