Profiling or monitoring heap size in Java or JavaEE app
At the normal operation, the Sawtooth wave should be observed. If heap size never come back after heavy weight process, passing critical region or entities loading then better watch out for “Data Cancer”. Sometime, it is way too much or impossible to load data to in-memory, perhaps not aware of loading the whole db in!! In that case, check these: properly handle transactions, properly load & release/dereference objects. Use the techniques like separation of R from CRUD (i.e read-only), use DBMS’s properties for caches.
This is using VisualVM to monitor the running JRE VM.