We're converting over an ASP site to ASP.NET and have written .NET class libraries that are used from ASP.NET and from ASP via COM Interop. When we deploy our changes to our production server everything seems to run fine for about a day with page file usage in Task Manager at around 200-300MB and the w3wp.exe process using about 180MB (physical memory is 1GB). CPU usage hovers between 15 - 25%. Then after one day of running fine the memory usage seems to shoot up. The page file goes up to 2GB and the w3wp.exe process churns through all available memory. CPU usage shoots up to 100%. We've tried enabling application recycling and setting a memory cap of 600MB. Sometimes this helps and another day or two will pass before another recycle takes place. Other times recycling occurs repeatedly with only minutes between recycles because W3wp.exe consumes all the memory moments after it's restarted. Our server is running W2k3 Web Edition. The problem appears to be caused COM Interop. Our class doesn't do much - it basically opens an SQL connection does a few DB things and closes the connection. Any help would be greatly appreciated.
2. Flash OCX Memory Leak, Or .Net Framework Memory Leak
3. Memory leak using interop for OS Authentication
5. Debug output tells memory leak (using .NET app with C++ interop dl
I am not sure this is the right forum. Could be Visual Studio C/C++ or VS #C. But here is the description: We are working on a .NET program which uses several dlls, both pure c# DLL'S and dll's written in C++ interop and in addition 3 party SW from several vendors. The managed C++ dll are wrappers for interfacing native C++ code which we have link in as static libraries. When we exit the program we get very many indications on memroy leaks dumped by the function _CrtDumpMemoryLeaks. After debugging a bit, the problem is that at the time _CrtDumpMemoryLeaks is called (destructor of afxState class inside MFC 8.0 dll), several of the managed C++ dll's are not unloaded, thus their static/global C++ objects destructors have not been called. Since we use system multithreaded dll's they share the same heap. Is there a way to be sure that _CrtDumpMemoryLeaks are called after all destructors have been called for all dll's? On stop the _CrtDumpMemoryLeaks called from the destructor of afxState?
6. COM Interop and memory leaks
7. memory leak with com interop
Hi,
I am trying to find out where there is a memory leak in our
application. I have created a test harness in C# to test this.
I'm basically hitting the object (written in c++) really hard by
looping through it
Here is the code in c#:
###################################
for (int i = 0; i<= 10000000; i++)
{
BPTACACSLib.TacacsAuthenicateClass tac = new
BPTACACSLib.TacacsAuthenicateClass();
string sessKey = tac.GetSessionKey("test", "dev", "127.0.0.1");
}
##################################
The instantiation of this object is eating up memory like crazy not the
GetSessionKey method. I know this because I've seen no change in
memory when I move the instanitation call outside the loop.
I have no clue as to why its eating the memory.
Here is the method if anyone wants to look in c++:
#########################################
STDMETHODIMP CTacacsAuthenicate::GetSessionKey(BSTR user, BSTR
password, BSTR IPaddress, BSTR *sessionKey)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
_bstr_t bstrUser(user);
_bstr_t bstrPassword(password);
_bstr_t bstrIPaddress(IPaddress);
char sSession[40]; memset( sSession, '\0', 40 );
CTacacsPlus tacacs;
tacacs.TacacsAuthenticate((LPCTSTR) bstrUser, (LPCTSTR) bstrPassword,
(LPCTSTR) bstrIPaddress, sSession);
_bstr_t bstrSessionKey(sSession);
*sessionKey = bstrSessionKey.copy();
return S_OK;
}
##########################################
Now if I call the COM object in ASP page it is NOT eating up memory
like I've described above.
This COM object is registered as a COM+ application in the component
services as well.
1. Can anyone help/direct me to know why the memory is being eaten up
on the instantiation or is there something I can do. What else can I
do to narrow down the problem and solve it.
2. Is there a reason why the memory doesn't get eaten up on regular asp
while it does on C# test harness?