Memory leakage while using ActiveX DLL

  • Thread starter Thread starter eSapient
  • Start date Start date
E

eSapient

I am struggling to figure out the cause of an out of memory exception I am
getting involving the use of an ActiveX DLL.

About three years ago, I developed an ActiveX DLL (called TFile.DLL below)
using VB6, and have since then invoked it successfully in other VB6 ActiveX
DLL projects.

Last year, I developed a web service with VB.NET where I used this DLL too.
The main code is in a web method, whose logic is basically like this:
___
Try
....
TDocument = New TFile.TDocument
mOraDynaset = CType(mOraDatabase.CreateDynaset(strQuery,
dynOption.ORADYN_NOCACHE + dynOption.ORADYN_READONLY), OraDynaset)
mOraDynaset.MoveFirst()
Do While Not mOraDynaset.EOF
TF = New TFile.TF
With TF
TDocument.A = ...
...
TDocument.L = new TFile.L
TDocument.L.L1 = ...
...
End With
TDocument.Write(TF)
TF = Nothing
mOraDynaset.MoveNext()
Loop
Catch ...
_________
This web method code has been working great. Task aspnet_wp.exe does not
show any sign of memory leakage.

Now I have migrated this code to a .NET class library. The code structure
has remained basically the same as shown above. However, during execution,
there is a gradual leakage of memory eventually leading to an out-of-memory
exception. I have placed Marshal.ReleaseComObject calls for all the COM
objects, but they don't seem to help.

Can anybody see any reason why this is happening and offer suggestions to
eliminate the memory leakage?

TIA.
 
I am sorry I messed up my message. Inside the With ... End With, please read
'TDocument' as 'TF'.
 
Back
Top