HubSpot / jinjava

Jinja template engine for Java
Apache License 2.0
690 stars 168 forks source link

hard max limit for slices #1169

Closed lozenko closed 5 months ago

lozenko commented 6 months ago

In some cases using ForLoop can led to OOM when we deal with many elements because we start to create lists with huge capacity.

In this PR we introduce MAX_SLICES limit. Additional improvement is to relax the heap usage by not copying elements to new ArrayLists rather reusing the one in ForLoop which has Iterator<?> it inside.

lozenko commented 5 months ago

added hard max limit