I just ran into a similar issue. The JPA program caches the SQL statements translated from JPQL to avoid the overhead of frequent conversions due to repeated queries. When I checked the memory usage with a JVM analysis tool, I found that the cached SQL queries were taking up a whopping 3000MB of memory space!
To fix this, I adjusted the maximum number of SQL statements that can be cached, and that did the trick.
Good luck!