Is this .NET problem

R

Ramesh K

Hi All,
During Attach to a process like DLLHOST ,DLLHOST has FILE references to
the system dlls like " odbc32.dll etc..(One can observer this in process
explorer tool of Sysinternals.com by selecting the "View Handles" from the
View menu)

But during the Detach process same handles are not getting released by the
DLLHOST process.WHY?

My application has a requirement that the custom dlls loadded into DLLHOST
can be unloaded(using cofreeunsued libraries) and modified whenever needed,
because of the above problem unakbe to update the custom dll.


steps to be folowed to simuate the problem.
Step1) create a C++ COM component named "A" and another C++ COM component
named "B" which creates "A" upon a method invocation let us say
CreateMe().Add another method in "B" to unload the component "A" letus say
KillMe()..in this method release the "A" reference and call
CoFreeUnUsedLibraries() so that "A" is unloaded.
Step2)Add "B" to DLLHOST using Component services asministrative tool
Step3)create a client application which creates component "B" anc calls
CreateMe() so that "A" is also created.Add another button to call KillMe()
of "B".
Step4)Open "A" in devenv. and attach to the DLLHOST(make sure dbgproxy is
running..as we are debugging Native C++ applicatipn to start this use net
start dgbproxy.exe from .NET command prompt).Now you can debugger loading
systems dll's and custom dlls in the output box..Now open Process
explorer(tool from sysinternals.com) and select teh View Handles option from
View menu..A.dll FILE handle is present here.
Step5)Detach "A" from DLLHOST
Step6)Now click on the button of the client application which calls KillMe()
of "B".Now the "A" DLL is unloaded. BUT Still the FILE reference for "A"
exists under DLLHOST

Any suggestions are welcome.


Regards,
Ramesh
 
I

intrader

Ramesh said:
Hi All,
During Attach to a process like DLLHOST ,DLLHOST has FILE references
to
the system dlls like " odbc32.dll etc..(One can observer this in process
explorer tool of Sysinternals.com by selecting the "View Handles" from the
View menu)

But during the Detach process same handles are not getting released by
the
DLLHOST process.WHY?

My application has a requirement that the custom dlls loadded into DLLHOST
can be unloaded(using cofreeunsued libraries) and modified whenever
needed, because of the above problem unakbe to update the custom dll.


steps to be folowed to simuate the problem.
Step1) create a C++ COM component named "A" and another C++ COM component
named "B" which creates "A" upon a method invocation let us say
CreateMe().Add another method in "B" to unload the component "A" letus say
KillMe()..in this method release the "A" reference and call
CoFreeUnUsedLibraries() so that "A" is unloaded.
Step2)Add "B" to DLLHOST using Component services asministrative tool
Step3)create a client application which creates component "B" anc calls
CreateMe() so that "A" is also created.Add another button to call KillMe()
of "B".
Step4)Open "A" in devenv. and attach to the DLLHOST(make sure dbgproxy is
running..as we are debugging Native C++ applicatipn to start this use net
start dgbproxy.exe from .NET command prompt).Now you can debugger loading
systems dll's and custom dlls in the output box..Now open Process
explorer(tool from sysinternals.com) and select teh View Handles option
from View menu..A.dll FILE handle is present here.
Step5)Detach "A" from DLLHOST
Step6)Now click on the button of the client application which calls
KillMe() of "B".Now the "A" DLL is unloaded. BUT Still the FILE reference
for "A" exists under DLLHOST

Any suggestions are welcome.


Regards,
Ramesh
Seems to me that what is happening is that resources are simply not released
as you expect, but that possibly the GC is involved. The resources will be
eventually returned. However, if you wait, say about sometime, and the
resources are not released, I suspect that you found a bonafined leak.
 
R

Ramesh K

Hi,
Thanks for the reply.
Even after waiting for a while these references are not getting
released.

Regards,
Ramesh
 
R

Ramesh K

My coding is not leaking...NET is not relasing the FILE handle during
Detach.

Ramesh
 

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