Please somebody help me with a memory issue while processing records with LOBs! So I have the following situation: I have two tables, and one of them is a table with some data. One of the columns of the table has "one-to-many" mapping to the second table. The second table keeps millions of photo images that are stored in LOBs. I use the "lazy loading" method to access the images. I need to iterate the first table's records to get photos and other information and send them to some SOAP-gate. Every time new data falls to the tables so I need the process to be restarted periodically. So I did and it works well for some amount of time but then suddenly stops with an exception like this:
июн 08, 2021 3:23:44 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:postgresql://x.x.x.x:yyyy/SomeDbInstance]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:92)
That is my app consumed out all the memory and stopped execution with this error.
So my question: is it possible to clean up processed entries to release the memory they start to consume after they got loaded?