Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
GetRequestStream gives memory leak (BUG?)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Thomas Phan  
View profile  
 More options Jan 5 2004, 1:29 pm
Newsgroups: microsoft.public.dotnet.framework.webservices
From: "Thomas Phan" <twhp...@entersys.com>
Date: Tue, 6 Jan 2004 02:27:16 +0800
Local: Mon, Jan 5 2004 1:27 pm
Subject: GetRequestStream gives memory leak (BUG?)
I've the following code

HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uploadUri);
...
request.Method = "POST";
using (Stream inStream..., outStream = request.GetRequestStream())
{
...
while ((bytesRead = inStream.Read(buffer, 0, buffer.Length)) > 0)
{
outStream.Write(buffer, 0, bytesRead);

}
}

If my inStream is huge (e.g. a huge XML file), i got my memory used up very
quickly, as everything get buffered in the outStream. The outStream sends
the data out, but it doesn't clear itself (as I got the sent data on the
server -- I wrote a HttpModule on the server and the memory is normal there)

I also tried to use outStream.Flush() after each Write(), but didn't
improve. I find that the stream may clear itself only when it's closed

I commented out outStream.Write, and the memory is ok (means that the
inStream and buffer don't leak)

I also tried the asynch call, begin/endgetrequeststream, but didn't get any
gd news

I'm using NetFx 1.1, I'm not sure if this is a bug or I did something wrong,
pls advice, thx

Thomas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Feroze [MSFT]  
View profile  
 More options Jan 7 2004, 12:10 am
Newsgroups: microsoft.public.dotnet.framework.webservices
From: "Feroze [MSFT]" <fero...@online.microsoft.com>
Date: Tue, 6 Jan 2004 21:05:54 -0800
Local: Wed, Jan 7 2004 12:05 am
Subject: Re: GetRequestStream gives memory leak (BUG?)
Yes, the data is buffered internally. This is used because in certain
situations,(eg redirect/auth) we might need to repost the dagta to a
different server.

You can disable this by setting AllowWriteStreamBuffering=false on the
webrequest.

--
Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Thomas Phan" <twhp...@entersys.com> wrote in message

news:#LyxMm70DHA.1576@TK2MSFTNGP11.phx.gbl...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas Phan  
View profile  
 More options Jan 7 2004, 1:53 pm
Newsgroups: microsoft.public.dotnet.framework.webservices
From: "Thomas Phan" <twhp...@entersys.com>
Date: Thu, 8 Jan 2004 02:51:54 +0800
Local: Wed, Jan 7 2004 1:51 pm
Subject: Re: GetRequestStream gives memory leak (BUG?)
Thanks Feroze,

It's good to know the buffering reason, thanks.

I really need to disable the buffer, as I'm writing a Http MultiPart request
to send huge files.

However, I get an exception in the client when I call:

Stream stream = request.EndGetRequestStream(ar)

My server requires authentication. I also set:

request.AllowAutoRedirect = false;
request.PreAuthenticate = true;
request.Credentials = ...

But it doesn't work. I thought the buffering feature was not there in .NET
FX 1.0

The exception says:

An unhandled exception of type 'System.Net.WebException' occurred in
system.dll

Additional information: This request requires buffering of data for
authentication or redirection to be successful.

How may I avoid this exception, and have the buffer feature off, thanks. If
necessary, I can modify my server code using HttpModule too, thanks.

Thomas

"Feroze [MSFT]" <fero...@online.microsoft.com> wrote in message

news:O4NvuvN1DHA.2324@TK2MSFTNGP09.phx.gbl...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas Phan  
View profile  
 More options Jan 8 2004, 12:35 am
Newsgroups: microsoft.public.dotnet.framework.webservices
From: "Thomas Phan" <twhp...@entersys.com>
Date: Thu, 8 Jan 2004 13:33:09 +0800
Local: Thurs, Jan 8 2004 12:33 am
Subject: Re: GetRequestStream gives memory leak (BUG?)
Hi Feroze,

I implemented my own Http Basic Auth on the server using HttpModule, it
works

However, the Windows Auth doesn't. Is there any setting to config, so that
the Windows Auth can work, thanks

Thomas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Feroze [MSFT]  
View profile  
 More options Feb 1 2004, 8:41 pm
Newsgroups: microsoft.public.dotnet.framework.webservices
From: fero...@microsoft.com (Feroze [MSFT])
Date: 1 Feb 2004 17:41:44 -0800
Local: Sun, Feb 1 2004 8:41 pm
Subject: Re: GetRequestStream gives memory leak (BUG?)
There are settings in the machine.config file to enable windows
integrated authentication. You can see the asp.net quickstarts which
are part of the framework sdk.

feroze.
===============
This posting is provided as is, without any warranties and confers no
rights.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »