I store images into objectdb.
The schema is :
<URI>::=(<sUrl>, <cMark>, <iSize>, <baBody>, <id>) <sUrl>::=String <cMark>::=char <iSize>::=int <baBody>::=byte[] <id>::=@ID
So simple a class will fail after 155,648 insertions with -Xmx1432m,
... NO = 151552 @ 8042217472 id = 0 @ 7703244276 Url = http://cimg2.163.com/catchpic/E/E9/E96492634557CE291CDF3AADC710F373.jpg NO = 155648 @ 8042217472 id = 0 @ 8016831165 Url = http://pic.tiexue.net/pics/2005_10_19_99028_599028.jpg Exception in thread "main" [ObjectDB 2.2.9_03] javax.persistence.RollbackExcepti on Failed to commit transaction: Java heap space (error 613) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:277) at image.URIReader.read(URIReader.java:84) at image.URIReader.main(URIReader.java:123) Caused by: java.lang.OutOfMemoryError: Java heap space at com.objectdb.o.BYW.r(BYW.java:86) at com.objectdb.o.ENH.c(ENH.java:212) at com.objectdb.o.ENT.R(ENT.java:738) at com.objectdb.o.STA.Z(STA.java:656) at com.objectdb.o.STM.H(STM.java:515) at com.objectdb.o.OBM.bG(OBM.java:858) at com.objectdb.o.OBM.bE(OBM.java:715) at com.objectdb.jpa.EMImpl.commit(EMImpl.java:274) ... 2 more
Question 1 : Why objectdb cause so many memory that it fails with "-Xmx1432m", even if em.clear() at every 0xFFF insertions?
Question 2 : Why the size of db increased to 16,671,309,824, while the original images are stored in a single file of 7GB?