HttpRequest.GetResponse() throws OutOfMemoryException


Hi Matt,
First of all, thanks for writing this excellent twitter library :) It's really handy!
In the time that I've worked with the library, I've found that it's really easy to get OutOfMemory exceptions when getting a server response from twitter. To work around it, I modified the library to simply allow for 'fire and forget' status updates to twitter. It's a bit heavy-handed, but it works for now with my scenario. I've attached the changes to this item so that you can see what I did.
It would be great if could incorporate a means to achieve this, selectively, as part of the main branch.
Let me know what you think.

file attachments


misenhower wrote May 5, 2011 at 4:48 PM

Hi Fabien,

One issue with discarding the entire response is that you never get to see what the HTTP response code was. I'm planning on adding a new HttpResponse class to parse out the HTTP header portion of the response and provide a Stream if the response body is needed.

In the mean time, try out this version of HttpRequest. Rather than setting up response buffers and a result string, this version uses a NetworkStream and dumps the response, line-by-line, to the Debug window.

Let me know if this improves the OutOfMemoryExceptions and I'll move on to implementing the HttpResponse class.

misenhower wrote May 5, 2011 at 4:49 PM

The updated version is the HttpRequest.cs attached to this bug.

wrote Feb 13, 2013 at 3:48 AM