memory leak in ASP.NET. 
Author Message
 memory leak in ASP.NET.

I seem to have one.

I have an API that consists of classes written in Managed Extensions for C++
that are wrappers for legacy C++ stuff.  I have a stand-alone program written in
C#.  My C# program looks okay.  I have run this program for several minutes and
it appears that the memory usage is relatively stable.

I also have tried the same C# code in an ASP.NET page.  I drive this
web-application by using WAST.  I find that in seconds the memory usage of
aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a gigabyte
of memory in only a few minutes.

So I wrote a simple Managed Extensions for C++ class that is pure, i.e. it is
not a wrapper for unmanaged code.  It has a ctor and dtor and some static data
members for counting instances.  In the ctor I up the counter and in the dtor I
down the counter.  Standard stuff.  And I use this to look at what's happening.

I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a small leak of
these managed objects.  The numbers go up and down a lot which is expected but
the low water mark gets a little bit higher fairly steadily.

That's a pretty easy experiment anyone can do and I invite anyone to try it if
they want to challenge my observations.

Anyway, this is using the Beta 2, so it's not exactly unreasonable to think
there might be a leak or 2.

My questions are about the Release Candidate.

Is there a document that lists bugs fixed in the RC1?
If not can someone tell me if the RC fixes any memory leak problems?
If I update to the RC1 will code built using the B2 work?

-Carl



Thu, 27 May 2004 10:56:11 GMT  
 memory leak in ASP.NET.
How much memory does the machine have?  The objects may not get destroyed
until the garbage collector runs.  Thus, if the machine still has memory,
and you are WASTing it, then, to keep throughput at max, the GC won't run
until the machine *needs* to have it run.

-Mike


Quote:
> I seem to have one.

> I have an API that consists of classes written in Managed Extensions for
C++
> that are wrappers for legacy C++ stuff.  I have a stand-alone program
written in
> C#.  My C# program looks okay.  I have run this program for several
minutes and
> it appears that the memory usage is relatively stable.

> I also have tried the same C# code in an ASP.NET page.  I drive this
> web-application by using WAST.  I find that in seconds the memory usage of
> aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a
gigabyte
> of memory in only a few minutes.

> So I wrote a simple Managed Extensions for C++ class that is pure, i.e. it
is
> not a wrapper for unmanaged code.  It has a ctor and dtor and some static
data
> members for counting instances.  In the ctor I up the counter and in the
dtor I
> down the counter.  Standard stuff.  And I use this to look at what's
happening.

> I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a small
leak of
> these managed objects.  The numbers go up and down a lot which is expected
but
> the low water mark gets a little bit higher fairly steadily.

> That's a pretty easy experiment anyone can do and I invite anyone to try
it if
> they want to challenge my observations.

> Anyway, this is using the Beta 2, so it's not exactly unreasonable to
think
> there might be a leak or 2.

> My questions are about the Release Candidate.

> Is there a document that lists bugs fixed in the RC1?
> If not can someone tell me if the RC fixes any memory leak problems?
> If I update to the RC1 will code built using the B2 work?

> -Carl



Fri, 28 May 2004 20:12:13 GMT  
 memory leak in ASP.NET.
Michael,

GC.Collect.

-Carl

Quote:

> How much memory does the machine have?  The objects may not get destroyed
> until the garbage collector runs.  Thus, if the machine still has memory,
> and you are WASTing it, then, to keep throughput at max, the GC won't run
> until the machine *needs* to have it run.

> -Mike



> > I seem to have one.

> > I have an API that consists of classes written in Managed Extensions for
> C++
> > that are wrappers for legacy C++ stuff.  I have a stand-alone program
> written in
> > C#.  My C# program looks okay.  I have run this program for several
> minutes and
> > it appears that the memory usage is relatively stable.

> > I also have tried the same C# code in an ASP.NET page.  I drive this
> > web-application by using WAST.  I find that in seconds the memory usage of
> > aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a
> gigabyte
> > of memory in only a few minutes.

> > So I wrote a simple Managed Extensions for C++ class that is pure, i.e. it
> is
> > not a wrapper for unmanaged code.  It has a ctor and dtor and some static
> data
> > members for counting instances.  In the ctor I up the counter and in the
> dtor I
> > down the counter.  Standard stuff.  And I use this to look at what's
> happening.

> > I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a small
> leak of
> > these managed objects.  The numbers go up and down a lot which is expected
> but
> > the low water mark gets a little bit higher fairly steadily.

> > That's a pretty easy experiment anyone can do and I invite anyone to try
> it if
> > they want to challenge my observations.

> > Anyway, this is using the Beta 2, so it's not exactly unreasonable to
> think
> > there might be a leak or 2.

> > My questions are about the Release Candidate.

> > Is there a document that lists bugs fixed in the RC1?
> > If not can someone tell me if the RC fixes any memory leak problems?
> > If I update to the RC1 will code built using the B2 work?

> > -Carl



Sat, 29 May 2004 01:31:32 GMT  
 memory leak in ASP.NET.
You can manually call the GC, but this isn't needed, since you are forcing a
collect at a sub-optimal time.  There are very few times you need to
manually force a GC.  With managed resources, that should be never.
-mike


Quote:
> Michael,

> GC.Collect.

> -Carl


> > How much memory does the machine have?  The objects may not get
destroyed
> > until the garbage collector runs.  Thus, if the machine still has
memory,
> > and you are WASTing it, then, to keep throughput at max, the GC won't
run
> > until the machine *needs* to have it run.

> > -Mike



> > > I seem to have one.

> > > I have an API that consists of classes written in Managed Extensions
for
> > C++
> > > that are wrappers for legacy C++ stuff.  I have a stand-alone program
> > written in
> > > C#.  My C# program looks okay.  I have run this program for several
> > minutes and
> > > it appears that the memory usage is relatively stable.

> > > I also have tried the same C# code in an ASP.NET page.  I drive this
> > > web-application by using WAST.  I find that in seconds the memory
usage of
> > > aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a
> > gigabyte
> > > of memory in only a few minutes.

> > > So I wrote a simple Managed Extensions for C++ class that is pure,
i.e. it
> > is
> > > not a wrapper for unmanaged code.  It has a ctor and dtor and some
static
> > data
> > > members for counting instances.  In the ctor I up the counter and in
the
> > dtor I
> > > down the counter.  Standard stuff.  And I use this to look at what's
> > happening.

> > > I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a
small
> > leak of
> > > these managed objects.  The numbers go up and down a lot which is
expected
> > but
> > > the low water mark gets a little bit higher fairly steadily.

> > > That's a pretty easy experiment anyone can do and I invite anyone to
try
> > it if
> > > they want to challenge my observations.

> > > Anyway, this is using the Beta 2, so it's not exactly unreasonable to
> > think
> > > there might be a leak or 2.

> > > My questions are about the Release Candidate.

> > > Is there a document that lists bugs fixed in the RC1?
> > > If not can someone tell me if the RC fixes any memory leak problems?
> > > If I update to the RC1 will code built using the B2 work?

> > > -Carl



Sat, 29 May 2004 02:39:01 GMT  
 memory leak in ASP.NET.
Michael,

I would really love to carry on this conversation about GC with you some other
time.  But right now, I'm getting a little impatient with you.  You responded to
my post, so can you answer my questions or can you not?

-Carl

Quote:

> You can manually call the GC, but this isn't needed, since you are forcing a
> collect at a sub-optimal time.  There are very few times you need to
> manually force a GC.  With managed resources, that should be never.
> -mike



> > Michael,

> > GC.Collect.

> > -Carl


> > > How much memory does the machine have?  The objects may not get
> destroyed
> > > until the garbage collector runs.  Thus, if the machine still has
> memory,
> > > and you are WASTing it, then, to keep throughput at max, the GC won't
> run
> > > until the machine *needs* to have it run.

> > > -Mike



> > > > I seem to have one.

> > > > I have an API that consists of classes written in Managed Extensions
> for
> > > C++
> > > > that are wrappers for legacy C++ stuff.  I have a stand-alone program
> > > written in
> > > > C#.  My C# program looks okay.  I have run this program for several
> > > minutes and
> > > > it appears that the memory usage is relatively stable.

> > > > I also have tried the same C# code in an ASP.NET page.  I drive this
> > > > web-application by using WAST.  I find that in seconds the memory
> usage of
> > > > aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a
> > > gigabyte
> > > > of memory in only a few minutes.

> > > > So I wrote a simple Managed Extensions for C++ class that is pure,
> i.e. it
> > > is
> > > > not a wrapper for unmanaged code.  It has a ctor and dtor and some
> static
> > > data
> > > > members for counting instances.  In the ctor I up the counter and in
> the
> > > dtor I
> > > > down the counter.  Standard stuff.  And I use this to look at what's
> > > happening.

> > > > I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a
> small
> > > leak of
> > > > these managed objects.  The numbers go up and down a lot which is
> expected
> > > but
> > > > the low water mark gets a little bit higher fairly steadily.

> > > > That's a pretty easy experiment anyone can do and I invite anyone to
> try
> > > it if
> > > > they want to challenge my observations.

> > > > Anyway, this is using the Beta 2, so it's not exactly unreasonable to
> > > think
> > > > there might be a leak or 2.

> > > > My questions are about the Release Candidate.

> > > > Is there a document that lists bugs fixed in the RC1?
> > > > If not can someone tell me if the RC fixes any memory leak problems?
> > > > If I update to the RC1 will code built using the B2 work?

> > > > -Carl



Sat, 29 May 2004 03:18:51 GMT  
 memory leak in ASP.NET.
Well, what you are describing seems like the normal behaviour for the GC,
and not a bug. There are many other posts with the same observations.

In the RC1 docs there is a change list. I don't believe there is a bug fix
list. The change list will show you what changes from B2 to RTM in the
System classes. I've read it somewhere a while ago, and I wasn't that
affected by the changes.

From other posts of people using RC1 (I'm staying with B2), you'll need to
recompile, and the .config files change somewhat, at least for web apps.

Again, I don't think this is a leak. How much memory do you have available?
Does GC.Collect make this go up? I didn't mean to offend you, but I don't
believe this is a bug.

-Mike


Quote:
> Michael,

> I would really love to carry on this conversation about GC with you some
other
> time.  But right now, I'm getting a little impatient with you.  You
responded to
> my post, so can you answer my questions or can you not?

> -Carl


> > You can manually call the GC, but this isn't needed, since you are
forcing a
> > collect at a sub-optimal time.  There are very few times you need to
> > manually force a GC.  With managed resources, that should be never.
> > -mike



> > > Michael,

> > > GC.Collect.

> > > -Carl


> > > > How much memory does the machine have?  The objects may not get
> > destroyed
> > > > until the garbage collector runs.  Thus, if the machine still has
> > memory,
> > > > and you are WASTing it, then, to keep throughput at max, the GC
won't
> > run
> > > > until the machine *needs* to have it run.

> > > > -Mike



> > > > > I seem to have one.

> > > > > I have an API that consists of classes written in Managed
Extensions
> > for
> > > > C++
> > > > > that are wrappers for legacy C++ stuff.  I have a stand-alone
program
> > > > written in
> > > > > C#.  My C# program looks okay.  I have run this program for
several
> > > > minutes and
> > > > > it appears that the memory usage is relatively stable.

> > > > > I also have tried the same C# code in an ASP.NET page.  I drive
this
> > > > > web-application by using WAST.  I find that in seconds the memory
> > usage of
> > > > > aspnet_wp.exe grows to hundres of megabytes.  I have seen it go
over a
> > > > gigabyte
> > > > > of memory in only a few minutes.

> > > > > So I wrote a simple Managed Extensions for C++ class that is pure,
> > i.e. it
> > > > is
> > > > > not a wrapper for unmanaged code.  It has a ctor and dtor and some
> > static
> > > > data
> > > > > members for counting instances.  In the ctor I up the counter and
in
> > the
> > > > dtor I
> > > > > down the counter.  Standard stuff.  And I use this to look at
what's
> > > > happening.

> > > > > I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a
> > small
> > > > leak of
> > > > > these managed objects.  The numbers go up and down a lot which is
> > expected
> > > > but
> > > > > the low water mark gets a little bit higher fairly steadily.

> > > > > That's a pretty easy experiment anyone can do and I invite anyone
to
> > try
> > > > it if
> > > > > they want to challenge my observations.

> > > > > Anyway, this is using the Beta 2, so it's not exactly unreasonable
to
> > > > think
> > > > > there might be a leak or 2.

> > > > > My questions are about the Release Candidate.

> > > > > Is there a document that lists bugs fixed in the RC1?
> > > > > If not can someone tell me if the RC fixes any memory leak
problems?
> > > > > If I update to the RC1 will code built using the B2 work?

> > > > > -Carl



Sat, 29 May 2004 03:31:45 GMT  
 memory leak in ASP.NET.
Hi Carl,
I dont believe this is a bug since the whole behaviour of auto Garbage
Collected classes is one where the .Net/COM+ framework determines when is
the best time to collect everything based on activity on the Managed heap
and other factors also. It is totally natural that with more classes being
created and threads/processes invoked on the Managed side the Managed heap
memory usage would go up substantially.
If WAST would drive the web-application like a user does (ie: not consistent
calls but with peaks and valleys in demand) then you would see the memory
usage go up and down mirroring this same cycle. In addition, if you are
worried that 1 million users are going to be accessing your ASP.Net page
simultaneously and steadily, then this is something that having multiple
servers (to handle the bandwidth the users are generating) was intended.

--
regards,
Robert Svilpa
Software Design Engineer in Test
Managed Extensions for C++
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.


Quote:
> I seem to have one.

> I have an API that consists of classes written in Managed Extensions for
C++
> that are wrappers for legacy C++ stuff.  I have a stand-alone program
written in
> C#.  My C# program looks okay.  I have run this program for several
minutes and
> it appears that the memory usage is relatively stable.

> I also have tried the same C# code in an ASP.NET page.  I drive this
> web-application by using WAST.  I find that in seconds the memory usage of
> aspnet_wp.exe grows to hundres of megabytes.  I have seen it go over a
gigabyte
> of memory in only a few minutes.

> So I wrote a simple Managed Extensions for C++ class that is pure, i.e. it
is
> not a wrapper for unmanaged code.  It has a ctor and dtor and some static
data
> members for counting instances.  In the ctor I up the counter and in the
dtor I
> down the counter.  Standard stuff.  And I use this to look at what's
happening.

> I find that in ASP.NET, i.e. aspnet_wp.exe, there appears to be a small
leak of
> these managed objects.  The numbers go up and down a lot which is expected
but
> the low water mark gets a little bit higher fairly steadily.

> That's a pretty easy experiment anyone can do and I invite anyone to try
it if
> they want to challenge my observations.

> Anyway, this is using the Beta 2, so it's not exactly unreasonable to
think
> there might be a leak or 2.

> My questions are about the Release Candidate.

> Is there a document that lists bugs fixed in the RC1?
> If not can someone tell me if the RC fixes any memory leak problems?
> If I update to the RC1 will code built using the B2 work?

> -Carl



Mon, 31 May 2004 04:04:44 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. How to call VB.net and ASP.net programs in MFC?(or,asp call vc)

2. Interop memory leak with VB.NET to VC++

3. memory leak in .NET framework with eventlog class

4. .NET MDI Memory leak

5. how to monitor memory leak in .net programs

6. Help - Memory leak in .NET ?

7. Integrated Session Management for ASP.NET and ASP 3.0

8. Asp vs Asp.Net (Field access)

9. writing C# assambly for COM+ and use it by asp/vb/asp.net

10. Accessing ASP(not ASP.Net) built-in objects with C#

11. need input ASP versus ASP.NET

12. ASP.NET application with Windows.NET RC1

 

 
Powered by phpBB® Forum Software