469,632 Members | 1,631 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

With proxy architecture, unmanaged DLLs appear to be leaking committed memory...

My program structure is:

1. [web interface]

2. [my managed code DLLs: C#]

3. [my proxy layer DLL: managed C++ classes mapping to unmanaged C++
classes] => manually does the crt-init and crt-terminate calls

4. [my pure unmanaged DLL] -- this is accessed by the unmanaged C++
classes in (3) using LoadLibrary and FreeLibrary

5. [third party DLLs and Windows DLLs including MFC71] => statically
links with MFC71, but dynamically links using LoadLibrary/FreeLibrary
with third party DLLs.


When I use the .NET Memory Profiler tool, I appear to have a problem
with my third-party unmanaged DLLs leaking memory that they normally
would not leak with a standard Windows program. However, when I
unload the DLLs from within the .NET environment, the Visual Studio
..NET debugger does not report any memory leaks.

For example, with one third party DLL that loads a 9MB DAT file when
it initializes, the committed memory leak is slightly larger than the
DAT file everytime I load and unload the third party DLL using
LoadLibrary and FreeLibrary from my pure unmanaged C++ DLL, and within
..NET Memory Profiler under "Committed Memory -- Potentially Shared --
this growing leak is tied to the dat file that the third party DLL
loads and unloads. If I put this code in a tight loop of load and
unload on the third party DLL, it quickly eats up committed memory
until things start to fail after maybe 1500 cycles. If I keep a third
party DLL in memory by not decrementing its LoadLibrary reference
count to zero, in the .NET Memory Profiler the .DAT file does not grow
beyond 9MB within the committed memory pane: it only grows if it is
actually unloaded and reloaded.

Does anyone have any clues on what might be wrong?

Any suggested Microsoft KB articles I should read?

Any free pizza?
Nov 17 '05 #1
0 1658

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Justin Lazanowski | last post: by
1 post views Thread by Bruce Vander Werf | last post: by
12 posts views Thread by doug | last post: by
4 posts views Thread by Technics | last post: by
reply views Thread by =?Utf-8?B?Y2hlbG9tYW4=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.