Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Stop trimming when mapTx is empty #8220
When CTxMemPool::TrimToSize is called with a very low number (like somewhere in mempool_tests), it is possible that the memory usage never sinks below the specified number.
This is unlikely to be a problem right now, but will be with the introduction of CTxMemPool::vTxHashes in #8068.
referenced this pull request
Jun 18, 2016
@pstratem Yes, given that there are various support data structures in the mempool whose size is hard to scale linearly with the number of transactions, this seems like a reasonable solution. There are certainly others (like requiring the trim size to be at least a multiple of a transaction + overhead), but this is so simple and probably something that should have been there as a safeguard from the start.