STM retains trec chunks
Summary
The RTS recycles trec chunks on each capability as they would presumably be hot in the cache and reduce garbage, but it never gives them up. Really the retained trec chunks shouldn't grow beyond what would be resident in the cache.
Steps to reproduce
Commit a single transaction that touches a large N number TVars and compare with a program that has N transactions that touch one (unique) TVar each time. The difference in max residency should be approximately the trecs. These are counted in the GC debug stats.
A workaround might be to decrease the number of capabilities to 1 then increase it back to N and collecting garbage. This might help some, but the remaining capability would still have its trec chunks.
Expected behavior
Only retain a reasonable amount of trec chunks (specifically the ones in cache...).
Environment
- GHC version used: all with threaded runtime.