• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Toplink + JPA + Swing App blasting heap?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic