The basic resolution to this problem is to reduce the max event block size in the advanced settings. This determines how many events the PSLwriter will try to save to RAM at one time:
For example, reduce this to 500 or in some rare cases you can make it even lower. Note that lowering this value reduces performance but will cause the engine to use less RAM.
Now, while that will resolve the issue it is also important to discuss other things which affect performance and RAM usage. These include:
1) The number of PSL instances which you have on the system. In general we recommend 1 instance per CPU core and 2GB RAM.
2) The amount of actual RAM on the box. I would never suggest running a production APP server with less than 8GB RAM. Also check which also is installed and using RAM on the system. Ideally an APP server should be a dedicated APP server.
3) The size of your events. Obviously 1000 events which contain a handful of int fields are going to take much less RAM than 1000 events which contain large strings. Your events should contain only the data being used for calculations. You should avoid large descriptions or string fields which are not needed.
4) The actual engine settings such as:
There are several settings here which can also affect RAM. The first is the number of consecutive days setting which you can see is 100 above. Reducing this can reduce the number of events being loaded and so can affect this error. However, if you have a large number of events then lowers this value may still not reduce the blocks of 1000 events you are loading into the system and so this setting by itself may not help solve this problem.
The second settings are the upper and lower memory bounds for the engine. It is important to understand that these are not hard limits. When the engine loads events to calculate, it is going to use as much RAM as it needs. This may be MUCH more than the upper bound. However, when it finishes it's calculation if it finds itself above the upper bound then it will attempt to free memory until it is below the lower bound. So these may not affect an out of memory issue, but if they are not set at all then I would recommend setting them if you get these errors. You may start at 2000 and 1000 and lower them further if needed. But this really depends a lot on available RAM and other factors.