NEST/Elasticsearch.Net version: 7.3.1
RecyclableMemoryStreamManager allocates small memory blocks by request, but the logic of freeing up the allocated memory is never invoked.
MaximumFreeSmallPoolBytes is not set anywhere and has a default value of zero, so the blocks are always returned back to the pool:
https://github.com/elastic/elasticsearch-net/blob/2638c1e9963680abd566b5b599cfb9f5e1045d0f/src/Elasticsearch.Net/Providers/RecyclableMemoryStreamManager.cs#L330
This leads to the growing large objects heap under load.
Thank you for raising this we will do another dive into the pool characteristics especially for longer running processes
related: https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream/issues/75
Opened to https://github.com/elastic/elasticsearch-net/pull/4172 to be able to visualize the characteristics of the memory pool.
Closing this to keep the discussion isolated on the PR. Please don't hesitate to comment there 馃憤
There is any chance of these fixes get into v6.x? It's happening on release 6.8.1, too :(
Most helpful comment
There is any chance of these fixes get into v6.x? It's happening on release 6.8.1, too :(