How can I reduce memory usage of my task?
Last updated
Was this helpful?
Last updated
Was this helpful?
Memory efficiency is a dynamic problem. Here are some tips for task code when memory constraints become a factor.
Any time a data set is iterated upon, any memory inefficiencies within the loop have a chance to be multiplied in severity.
Remember that Liquid variable assignments (i.e. any use of the ) are always by value, not by reference. This can lead to surprise memory exhaustion with large values. Check on your assignments, concatenations, captures, etc.
A single task run has a limited amount of memory available to it, but you can generate as many task runs as you like. If you need to "fork" into multiple task runs, use to create events with just enough data to create multiple tightly-scoped task runs.
Task runs responding to are allocated more memory than regular task runs. If you aren't already using one, consider whether your use case could be achieved using a bulk operation.