What is the maximum size of the memory pool? The memory pool holds unconfirmed transactions in RAM. It seems that memory pool storage could overflow if no block is solved for a very long time and many transactions are published within a short interval.

In browsing the source code, I found no mention of a cap on the memory pool size:

https://github.com/bitcoin/bitcoin/blob/v0.10.1/src/main.cpp#L934

Does such a cap exist? If not, couldn't an attacker use the unbounded size of the memory pool to overflow the RAM of a large number of nodes, knocking them offline?

I noticed two proposals that seemed to address this issue, but neither has made it through the approval process:


Mempool Superblock
Mempool Janitor
There is no cap on the maximum size of the mempool, nor a janitor which cleans up transactions which are not confirming. Loss of unconfirmed transactions isn't a problem as wallets are supposed to rebroadcast transactions if they don't confirm within a reasonable time frame, so it wouldn't be unreasonable to drop them in a critical low memory situation. The limit on free transaction relay is there partly to prevent this from being an issue, it would be fairly expensive to pack the mempool with junk from a fee standpoint.