Hi all I have writeen program which read text file and insert each records into SQL 2000. Text file has around 200,000 records. The problem i have found is it consumes lots of memory while program is running and inserting records. The memory goes up to 256MB and start decreasing and than at some stage it throws OutOfMomory Error message. Most of my variables are Stirng and few float. Its a very simple java application, which load jdbc driver, make conncetion to data base and prepare sql statement and so on. I thought garbage collector should run automatically when jvm reaches max to the heap size but i think gc is not able to free enough momory for the request and therefore i got outofmomory error message. Hope some has same kind of problem and have some kind of solutions.
It sounds like your not cleaning up after yourself. Do you free up all temporary/local variables after use? Maybe the program is creating temporary objects(behind the scenes) which are not getting cleaned up? by the way, on the topic of performance, are you executing each PreparedStatement separately or are you batching them? If you are not batching look into it, sounds like you could gain some real performance gains here! jamie If possible, post the code. It would make it easier to give better quality advice. Sounds like a small class anywho!
[This message has been edited by Jamie Robertson (edited August 22, 2001).]
Joined: Aug 13, 2001
Hi Jamie Thank you for your reply. I solved moemory leak problem in my porgram. It was my code which was doing it. I had prepared statment in side while loop and it was causing all the problem. I took that prepared statement out side the while loop and ran the program and it worked like a dream. I would like to attach code with this response but i don't know how to attach file here. Thank you once again for your help. Regards, Rashmi