Out of heap caused by database access

Hi guys. I have a serious problem in my last project. I use a database to get/insert information that I need. Every now and then there is A LOT of db I/O going on (1-2mb of data being loaded/accessed).

I am using a singeton pattern (one instance) for the db connection to ensure that there is only one connection between the software and the db. The problem here is that I eventually run out of heap size. Is there any way to overcome this situation? Something like flushing db buffer (or whatever).

If I use many connections (open one, perform query/insert, close) I eventually run out of sockets because Java states that closing the db connection doesnt free the resources straigh away.

So I am stuck. If anyone can help I would really appreciate it. thx

[781 byte] By [JohnFisha] at [2007-10-3 3:39:20]
# 1
You're doing something that doesn't release memory. So stop doing that.But you don't know what to stop doing, right? Then you'll have to find out what's filling up your memory. The tool for that is called a "profiler". Get one and use it.
DrClapa at 2007-7-14 21:34:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...