-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Net.Httpin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue
Milestone
Description
I was looking at a memory trace of HttpClient today, and noticed this. Response buffering in HttpClient uses MemoryStream under the covers to buffer the response. MemoryStream does not currently use pooled buffers (i.e. `ArrayPool'). Seems like using pooled buffers here would be a better solution and would avoid GC costs.
There's an issue for MemoryStream to use pooled buffers itself here: #22428. If this got implemented, we could simply use this. It's unclear if/when this will happen, though.
Alternatively, we could just implement our own Stream here for response buffering, instead of using MemoryStream. This may have additional advantages since we don't really need all the functionality of MemoryStream here.
antoniofreire, kostya9, GSPP, rubenprins, bsymo and 1 more
Metadata
Metadata
Assignees
Labels
area-System.Net.Httpin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedtenet-performancePerformance related issuePerformance related issue