ADO 2.5 and memory leaking when adding records (ignore last one) 
Author Message
 ADO 2.5 and memory leaking when adding records (ignore last one)

I have a small utility to copy records from one database to another (between
DB2 and SQL7)
Reading from the source database works fine.  Writing to the destination
database leaks memory.

I am opening the destination like so:

   Set m_rsOutDB = New ADODB.Recordset
   m_rsOutDB.CursorType = adOpenKeyset
   m_rsOutDB.CursorLocation = adUseClient
   m_rsOutDB.LockType = adLockOptimistic
   Call m_rsOutDB.Open(m_sDBSchema & "." & m_sDBTable, m_cnOutDB, , ,

and then I loop through the source database:

    Do Until m_rsInDB.EOF

        ' populate the destination fields


This seems to work fine but eventually I blow up because my virtual memory
has been used up.  I tried closing the destination record set and connection
once in a while but nothing worked until I actually did a:

         Set m_cnOutDB = Nothing

and only then did I see the memory be freed up.

So I have done a workaround where I free up all of my destination objects
every 10,000 records or so, reopen them all, and continue. It works but it
does slow down the process and is kludgy.  I also tried doing the adding in
batch mode but the same problem occurs.  I get the impression that even
though I am doing an AddNew, populating fields, and an Update that it is
still building up a recordset in the background and never releasing it.

Is there a known problem with 2.5 or should I be setting up my connection
differently.  I tried using a server side cursor since I really don't need a
client side one but that wouldn't even run.  I tried just creating the SQL
INSERT statement myself and executing it via a command object but 1. It
wasn't any faster and 2. If I have DB2 as the destination it blows up
because the DB2 ODBC doesn't allow strings larger than 32K.

Many thanks

Richard Speiss

Sun, 13 Jul 2003 06:31:01 GMT  
 [ 1 post ] 

 Relevant Pages 

1. ADO 2.5 and leaking memory when adding records

2. Memory leaks using ADO 2.5

3. memory leaks with mdac 2.5

4. ADO 2.5 Sql Server Ole Db Provider and Memory Loss

5. ADO 2.5 & Heavy Memory Usage

6. ADO Memory Leak results in out of memory

7. Ignore my last message, read this one!

8. Obtaining the count of records using ADO 2.5 and a stored procedure

9. ADO 2.5 filters records incorrectly

10. ADO 2.5 Large Tables returning 0 records

11. Where is MDAC 2.5 SDK (ADO 2.5)

12. ADO 2.5 bugs(?) and ADOX 2.5


Powered by phpBB® Forum Software