Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory leak

Status
Not open for further replies.

wxz44428

Programmer
Aug 10, 2001
3
US
(This is probably an ASP question, but since the
real question is the memory accumulation under mtx.exe,
so I posted my question here also.)

My asp page is creating a com object,
using Server.CreateObject("progid")
and then call one of its method, at last set it to
nothing. like the follwing:
<%
if IsEmpty(Session(&quot;obj&quot;)) then
set obj = Server.CreateObject(&quot;progid&quot;)
Set Session(&quot;obj&quot;) = obj
else
set obj = Session(&quot;obj&quot;)
end if

obj.method(some parameters)

set obj = nothing
%>

The problem is, if I keep on refreshing the web
browser, I can see the server side mtx.exe memory
usage keep on going up, as shown by NT performance
monitor on mtx.exe's private bytes. However, if
I wrap the same code within a VB application, and
put the method call within a big loop, as shown
below, performance monitor shows a flat plateau,
the memory useage does not increas at all.

VB code:
set obj = CreaetObject(&quot;progid&quot;)
for i = 1 to 100
obj.method (parameters..)
next
set obj = nothing

I know I am not suppose to assign the object var to
a session variable, since my object is of &quot;Apartment&quot;
model. However, if I don't do that, whenever the user
refresh the browser, the object will be recreated, and
MTX is not releasing the old object right away, meaning
task manager will show even more memory accumulated.

My object's method does not throw any exceptions at
all.

I guess my question is, how come VB app shows no memory
accumulation, while mtx.exe does ? I learned from MSDN,
on components that throw exceptions, there are some
particular cases that memory leak will happen, but as said,
I am not throwing at all.

I am using NT4.0 SP5, IIS 4.0, VBScript 5.5, and my
object is written with VC++ 6.0 SP3.

Thanks in advance for your kind assistance.
 
I think &quot;set obj = nothing&quot; is not needed.In your MTS object you should can SetComplete/SetAbort to tell MTS executive to &quot;release&quot; the object.

Regards!
zallen@cmmail.com
Long live of freedom!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top