Wednesday, July 21, 2004

More about the HttpWebRequest/HttpWebResponse leaks

Steve Binney contacted me through e-mail and provided some feedback about the .NET HTTP infrastructure leaks I've (actually, everyone have) been having. The two last e-mails I had from him provided some very useful observations about the bug:

Email #1

I decided to be brave and install .Net 1.1 SP1 on my laptop. Unfortunately, the leaks still seem to be there. In Reflector, I have verified the HttpWebResponse/Request still have the leaks.

Email #2
To clarify my observations:

On the released version of .Net 1.1 and .Net 1.1 sp1 beta:

My app makes one synchronous HttpWebRequest/HttpWebResponse per second on a single thread. My handle count starts at 200 and ramps up to approx. 1200 before automatic GC kicks in. Memory (private bytes) start at 7 mb and quickly ramps to 20 mb before leveling off. The memory slowly creeps up after that. On a few occasions, the memory quickly increased to 60 mb but I cannot reproduce this. Calling gc.Collect stops the handle leak but has no effect on memory.

On VS 2005 Beta 1, .Net 2.0 beta 1:
Memory and handles are constant at (< 200 handles) and (18 mb). Using reflector, I see that the HttpWebRequest/HttpWebResponse clean up the
event handles created by internally calling begin/end async methods.


I have mixed feelings about this input: while it's very good news that VS 2005 does not have the same leaks, I feel a bit frustrated that this bug is not fixed yet in the .NET 1.1 SP1.
Steve and I also posted this on microsoft.public.dotnet.framework, but by Feroze feedback I feel it'll be a long, long run until a solution. Feroze didn't even seem to have looked at or tried the 10-line code snippet I posted. Probably I'll be using .NET 2.0 before that is fixed...

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?