I'm writing a web scraping application which creates a lot of concurrent HttpRequests to various websites using proxies.
Most of these websites have SSL enabled. My application uses a lot of memory which was strange so I decided to investigate and found out that SslStream
PinnableBufferCache
is not being collected by GC.
I have disabled ReadStreamBuffering
and WriteStreamBuffering
on HttpRequest
, set HttpRequestCachePolicy
to NoCacheNoStore
and set KeepAlive
to false
, however the problem still remains and underlying SslStream
cache is not being collected by GC.
I'm unable to post my code example since core of it is huge with concurrent model to provide proxies and task manager which controls concurrent scraping threads that make the request. However I have provided a screenshot of .NET memory profiler that explains my problem