I am using Spring + Hibernate in my java web application. I read in the web that spring and hibernate will use more memory than usual. Frequently I am running out of memory. So I tried to profile my tomcat by using jvisualvm. When I see in memory, objects are keep on adding (not replacing existing objects).
For example: if I am loading a list of product objects (1000 objects in the list), then 1000 product objects will be added in heap memory. If I refresh the data grid again it is adding 1000 objects in heap memory, like that it is keep on increasing (see the image). is there a way to Replace existing objects in heap memory instead of keep on adding?