memusage: let PoolResource keep track of all allocated/deallocated memory
We recently (in #28906) had OOM problems due to incorrect memory usage estimation. When PoolResource is used the estimation can be brittle because when implementing memusage estimation for a container it is not obvious when the pool can be used.
As suggested here https://github.com/bitcoin/bitcoin/issues/28906#issuecomment-1817885270, to prevent these problems in future we can simply let the PoolResource do all the accounting. Then the memory usage estimation is always accurate, even when the pool's memory chunks cannot be used.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Code Coverage
For detailed information about the code coverage, see the test coverage report.
Reviews
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| Concept ACK | hebasto, jonatack |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #28531 (improve MallocUsage() accuracy by LarryRuane)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Concept ACK.
Could rebase for fresh CI?