Memory leakage while using ActiveX DLL

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.
 
E

eSapient

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top