473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASP.NET Not Releasing Memory

I have an unmanaged COM DLL written in VC++ 6.0. Its threading model is
registered as "Both" and it has a free thread marshaller. I am using the
object from an ASPX page. On the creation of the first instance of the
object, aspnet_wp.exe's memory use goes way up (20M+), then stays pretty
stable. In each execution of the page, I create a new instance of the object
and then free the object using

While System.Runtime.InteropServices.Marshal.ReleaseComO bject(theObj) > 0
End While

However, I do notice that the amount of memory in use does increase over
that base amount by a few K on each request. It seems that it increases by an
amount that is related to the size of some string results returned from the
object (some of the "Get" methods of the object return String (BSTR)
results). I am using the following code inside the DLL to set the values of
those results (some details excluded for brevity):

STDMETHODIMP CTheObj::get_Buffer(long BuffNum, BSTR *Buff) {
// stringBuffer is a char[] member variable whose value is set by other
methods
*Buff = ConvertStringToBSTR((const char *)stringBuffer);
return S_OK;
} // end of get_Buffer

// Not my code, copied from other fora
inline BSTR ConvertStringToBSTR(const char* pSrc) {
if(!pSrc) return NULL;

DWORD cwch;
BSTR wsOut(NULL);
if (cwch = ::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, NULL, 0)) {
// get size minus NULL terminator
cwch--;
wsOut = ::SysAllocStringLen(NULL, cwch);
if (wsOut) {
if(!::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, wsOut, cwch)) {
if (ERROR_INSUFFICIENT_BUFFER == ::GetLastError())
return wsOut;
::SysFreeString(wsOut);//must clean up
wsOut = NULL;
} // end if
} // end if
} // end if
return wsOut;
}; // end of ConvertStringToBSTR

In the ASPX page, I set the String variable to Nothing after I use it.

Am I doing something incorrectly here?

--
Glenn Miller
Optinfo, Inc.
Nov 18 '05 #1
0 1001

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lebo | last post by:
Hi I'm trying to understand how Python handles memory usage and dynamic object loading and unloading. Problem to solve? Build a very low memory footprint (non-GUI) Python application for...
7
by: trialproduct2004 | last post by:
Hi all I am having application in c# where i am loading one table of database into dataset. My table is of large size. so whenever i am loading that into dataset my memory size is getting...
2
by: M.Ob | last post by:
Hello... I am having issues with my asp.net apps not releasing memory. The memory usage for the process w3p.exe continues to grow to it's allowable limit and does not drop until the app pool is...
8
by: Sean | last post by:
I have a service that is pulling alot of records from a SQL Server table in a DataSet. This process takes up alot of memory, which is to be expected. But when the process is finished, I am clearing...
5
by: Mark Rae | last post by:
Hi, I'm encountering a strange phenomenon whereby a DataSet object is not releasing its memory when it's being disposed and/or set to Nothing. It is part of a Windows service written in VB.NET...
12
by: iker.arizmendi | last post by:
Is there any way to get Python to release memory back to the C allocator? I'm currently running a script that goes through the following steps: 1) Creates a very large number of Python objects...
3
by: ib | last post by:
ICloneable::Clone returns a new instance of the object being cloned. However, it seems possible that the garbage collector could release this memory before the calling function receives a reference...
5
by: Ian Boyd | last post by:
Customer is running a load test against a websphere application that uses DB2. While the load test is running the memory usage of DB2 climbs from x up to y. When the load test ends, the memory...
1
by: amollokhande1 | last post by:
Hi All, We have ASP.Net based content management web application. We are performing lots of XML based operations like setting the innerxml, loading the xml, string replace operations on XML etc....
2
by: enggwaqas | last post by:
Hi guys, I have a memory problem in my vb.net application. It's actually a point of sales system, which must be keep running the whole day. The problem is: application is not releasing any memory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.