If a macro or plugin runs out of memory, you can force garbage collection.
The Java Virtual Machine does garbage collection automatically as necessary, but this can also be forced at a particular time in a plugin or a macro.
In a macro use the call() function (needs version 1.37e):
call("java.lang.System.gc");
In a plugin use the call:
System.gc();