• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Toplink + JPA + Swing App blasting heap?

 
Florian Soko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I'm trying to develop a simple swing application with JPA and Toplink as persistence provider using Netbeans IDE.

So what I try to do is saving my data in a MySQL database. I'm reading images from my harddrive and then save them in a blob field in my database table. After inserting 100 images with each 1 Megabyte, my 128Mb heap is filled up and my application throws an exception.

So what I've done is calling entityManager.clear() in my finished() method of my save task to clean up my persistence context, so all my objects are detached. But if i watch my memory usage in the "windows vista task manager", it is still growing with every inserted image. It's not growing as fast as without entityManager.clear() but it will still blast my heap size after running e.g. a whole day.

Can anyone help me to avoid this? I just want to create a simple swing application to save some entries in my database tables. Maybe I could do it with plain JDBC but I like the way the JPA stuff is working.

Thanks, Florian.



 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to disable or decrease the size of your shared cache. ("toplink.cache.shared.default"="false", or "eclipselink...", "toplink.cache.size.default"="10").

If still having issues, check that nothing in your application is holding onto old objects. You may wish to try a memory profiler such as JProfiler.
You might also want to upgrade to the lastest version of TopLink (EclipseLink 1.1).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic