We are seeing a very large increase in heap allocation by Hibernate when creating our queries when we migrate beyond 6.5.X. It looks like it may be related to our use of sub-queries. We raised HHH-19240 and see that HHH-19292 looks to be the same issue.
We would have to roughly double our pod RAM to avoid an OOM issue and the related ticket application’s RAM went up seven fold and the example project I posted also uses about 7 times the heap comparing v6.6.11 with v6.5.3 for a query with sparse entity classes and no data.
The memory is allocated the first time each of the queries is encountered and looks to be related to use of ANTLR. And obviously - if these queries are being initialised in parallel the heap required compounds badly.
We tried using a more aggressive ‘compact’ GC algorithm and were able to reduce the in-flight heap to about four times the v6.5.3 levels implying that this heap allocation cannot be substantially mitigated, even if there isn’t a leak.
So my questions are:
- Is use of ANTLR in this way a done deal and using sub-queries henceforth will just need much more heap?
- Will any changes in 7.X affect this increased memory requirement for better or worse where sub-queries are in use?
Would appreciate any input on this. Hibernate is a very important library for us.