-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I did something as simple as this (see below), and then had a batch file that just does CURL over and over and over against this endpoint.
For each request, there is one instance of HttpListenerRequest, HttpListenerResponse, HttpListenerContext, HttpConnection and several other types being left unreleased, according to general memory usage as report by task manager but also .NET memory profilers such as https://memprofiler.com/ (and the fact that it crashes with EOutOfMemoryException if left alone for a while).
I thought a simple .Response.Close() would be enough, but apparently not..? .Abort() does not help either, nor does setting KeepAlive = false.
MSVS 2012, .NET 4.6.1, installed from NuGET (1.0.50)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SocketHttpListener.Net;
namespace ConsoleApplication29
{
class Program
{
static void Main(string[] args)
{
var listener = new HttpListener();
listener.Prefixes.Add("http://+:8899/");
listener.OnContext = (HttpListenerContext context) =>
{
Console.WriteLine("request " + DateTime.Now);
context.Response.KeepAlive = false; // nope
context.Response.Close(); // nope
//context.Response.Abort(); // nope
};
listener.Start();
Console.ReadKey();
}
}
}
Metadata
Metadata
Assignees
Labels
No labels