TdsParserStateObject.bTmp should be releasable
- Dominant language
- C#
- Stars
- 989
- Forks
- 340
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 72
Description
The `bTmp` variable is used as a temporary buffer for various internal operations, if it is null or too small a larger `byte[]` is allocated and assgined to it. There is nothing that sets it to null. Over time if a process has operations that deal with large strings or byte arrays the bTmp of all pooled state objects will grow to be a sometimes significant amount of memory, i've seen 2/3 of a process allocated memory in bTmp.
We should look at providing a way to trim these buffers to be good citizens to the rest of the process. We should see if this can be done without adverse effects on overall throughput. Approaches I can think of:
1) null the buffer on return to the pool
2) detect gc pressure using Gen2GCCallback or something similar and null
3) rely on pool culling on timer and null if the parent has remained pooled for a certain minimum time.
Contributor guide
Assessment
This issue has not been assessed yet.