Memory leak when using "Spend on Items for Free Items" discount and setting redemption limit per order to unlimited

Vote:
 

We are noticing high memory usage when using this discount. This happens when we are calling IPromotionEngine.Evaluate for those entries targetted by the discount.

Everything works normal if we set at least 1 per order redemption limit and it usually takes 1-3 seconds. If we set it to unlimited, it takes 20-30 minutes and our machines are almost unusable. Looking at the memory profiler, it does signify a memory leak.

We have only tested this for "Spend on Items for Free Items" discount but we reckon anything relating to "Free Items" is affected.

Has anyone else experienced this?

#204367
May 29, 2019 8:25
Vote:
 

You are very welcome to contact our developer support service and send a memory dump. We're happy to look into this

#204369
May 29, 2019 9:47
Vote:
 

We encountered the exact same issue with the "Spend on Items for Free Items" discount, while it works just fine with other discounts.

In our case, this was caused by an InMemoryOrderGroup that was created with a high price and quantity. I would assume this also happens with regular Order Groups.

We noticed, that the memory usage goes through the roof with a high quantity, because a new RewardDescription is created for every quantity.
With just a high price, the memory usage is fine, but the execution time is extremely long. I'm thinking that the discount is applied for each time the minimum price of the discount "fits" in the price.
Those two in combination make it run extremely slow and with extremely high memory usage.

The solution is then to try to avoid extremely high quantities and prices in order groups, if possible, or restrict the limit per order directly on the discount.

#266444
Nov 09, 2021 8:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.