Azure/DotNetty

Memory not dropped after the connection closes

FabianHummel opened this issue · 0 comments

The BufferAllocator allocates 16mb (by default) when a new connection is created, but does not free it when the connection is closed. Why is that? Are there any solutions? Call the below code in a whil(true) loop with a bit delay and see memory skyrocketing into GB-area. I honestly thought the library is bug-free?

Version: every version

Example:

var group = new MultithreadEventLoopGroup();
var bootstrap = new Bootstrap()
    .Group(group)
    .Channel<TcpSocketChannel>()
    .Option(ChannelOption.TcpNodelay, true)
    .Handler(new ActionChannelInitializer<IChannel>(c =>
    {
        c.Pipeline.AddLast(new StringEncoder(),new StringDecoder(),new TelnetClientHandler());
    }));

await bootstrap.ConnectAsync(IPAddress.Parse("127.0.0.1"), 3000);
await group.ShutdownGracefullyAsync();