I have a small-ish Spring MVC app using Boot 2.3.3. Immediately after startup, this uses 20MB of heap (after triggering a GC).
Changing to Boot 2.4-M2, it uses 140MB. I've also tested with M1 which doesn't display the issue.
Heap dump analysis shows that 125MB of heap is being used by org.springframework.scheduling.support.BitsCronField, because there are 15 million objects in a long[].
My application doesn't use scheduling i.e. there is no @EnableScheduling annotation.
Comment From: daniel-liy
Is there a complete sample code and runtime environment? eg.
Comment From: poutsma
Thanks for spotting this. I will have to refactor this code and remove the usage of BitSets.
Comment From: leccelecce
Hi @poutsma - do you need anything from me for this or is it an obvious change? I can't share the full application code but could have a go at stripping things down to a working example.
Comment From: poutsma
Thank you, but I don’t think (or hope) that I need application code to solve this. I simply had no idea that BitSet uses so much memory, and we should be fine by using a long or even int for this use case.
Comment From: poutsma
This should be fixed now. @spazbob Can you try a recent snapshot and see if that resolves things?
Comment From: leccelecce
Hi @poutsma, I had some issues moving our app to a snapshot release - I will try again in a few days.
Comment From: leccelecce
@poutsma now tests correct - sorry for the delay!