QueryImpl consuming more memory


In my application I see most of the memory used by hibernate is on QueryImpl class and the query retrieves data from sample employee class. I use getResultSet to retrieve the resultset. When there is concurrent request, the allocation increases without releasing the memory though request is completed. Let me know if any thoughts to free up memory. The instance count displayed here is on concurrent execution of 5 requests.


What you see there is probably the objects that haven’t been collected by the JVM GC, but the proble might be that you are fetchcing more data than necessary.

Try using DTO projections because they are more efficient both on the database and on the client side.

More, if you have huge Result Sets but only require 10 entries, better use pagination.

Query specified join fetching, but the owner of the fetched association was not present in the select list

Thank you Vlad. I followed DTO projection implementation from your performance guide book and while implementing I noticed this error. Can you please help.