I have a thread that runs and accesses a Database table using JDBCODBC bridge. . The purpose of the thread is to query the source table and calculate a summary then INSERT that summary into a destination Table. The thread checks the destination table first for a record on the day that you are currently checking. If a duplicate is found then skip accessing the source table. If a duplicate is not found then access the source table for the day you are checking for, calculate summary and INSERT data into the destination table. Decriment the Calendar date by 1 and continue looping under the above conditions until July 7th 2002 is reached, at which point the date loop exits and the thread exits.
The execution summary of this thread is the following; -load settings data from database. This is done in the constructor as it only needs to be done once. -When thread is started then loop forever with a 5 minute delay between loops... -every loop does the following ------Determine currentDay and endDay (preset 7/1/2002 july 1 2002) ------Begin Date loop sarting from Todays date to july 1 2002 ------For the current date Check to see if there is a record already calculated in the destination Table ------------YES duplicate found Skipp source table access ... ------------NO duplicate not found. Access source table for current loop date and calculate a summary record. INSERT this summary record into the destination table ------decriment Calendar date by 1 ------Loop until july 1 2002 (exit after july 1 2002 has been checked) -null String objects and other Objects no longer used etc -exit thread
Now i have tried to null every object in the class but that does not seem to help. THis leads me to believe that it is the accessing the database tables so many times that is the problem. I do null the result after i use it though. hmmm or rather i null the object that contains the result set, that should release the reference to this dataset though and make it available for System.gc() right? Currently every completed date loop (meaning that the loop has stepped from todays date to july1 2002)eats about 3 megs of memory and does not release even after the thread has exited. I put a message in the finalize method of my class to ensure that it exits and it does. So why is my memory not getting released. I even call System.gc() before the tread exits to help prompt a Garbage collection (yes i know its a low priority thread and calling System.gc does not mean it immediately does a garbage collection) PLEASE i could use some help with this situation. I am currently using win2k server sp2 with SQL server 2000 sp2. I have also tested this problem on WintNT 4.0 server SP6a and SQLServer 7.0 sp4 [ August 28, 2002: Message edited by: Steven Kors ] [ August 28, 2002: Message edited by: Steven Kors ]
Joined: Jan 30, 2002
resolved my problem an embarassingly easy fix too hehe Sometimes the easiest of solutions are the hardest to find [ August 29, 2002: Message edited by: Steven Kors ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com