Implement accurate memory accounting for mempool #6410

pull sipa wants to merge 1 commits into bitcoin:master from sipa:mempoolusage changing 8 files +110 −2
  1. sipa commented at 6:37 PM on July 9, 2015: member

    This implements accurate memory usage accounting for the mempool. It is only exposed through getmempoolinfo for now, but could be used for limiting the resource requirements too (#6281).

  2. sipa cross-referenced this on Jul 9, 2015 from issue Limit mempool size by pstratem
  3. sipa force-pushed on Jul 9, 2015
  4. sipa force-pushed on Jul 9, 2015
  5. laanwj commented at 10:57 AM on July 10, 2015: member

    Tested ACK.

    Nit: I'd slightly prefer DynamicUsage for eg uint256 as helper functions outside the class instead of added members.

  6. laanwj added the label RPC on Jul 10, 2015
  7. Implement accurate memory accounting for mempool 5098c47b24
  8. sipa force-pushed on Jul 10, 2015
  9. sipa commented at 2:55 PM on July 10, 2015: member

    Updated to retain the totaltxsize field in the RPC output. @laanwj I avoided the need for a DynamicMemoryUsage for uint256 altogether now.

  10. laanwj commented at 3:08 PM on July 10, 2015: member

    Ok, even better.

  11. sipa cross-referenced this on Jul 10, 2015 from issue MemPool: Convert mapTx to boost::multi_index_container by ashleyholman
  12. jonasschnelli commented at 9:48 AM on July 11, 2015: contributor

    Review ACK. utACK (code is now running on bitcoin.jonasschnelli.ch) very minor nit: some ifs have opening brackets on the same line, some not. But i don't care.

  13. sipa commented at 10:44 AM on July 11, 2015: member

    Re code style: I'm aware, but I'm always following the style of the surroundig code.

  14. jtimon commented at 11:36 AM on July 11, 2015: contributor

    utACK

    Regarding style, I believe https://github.com/bitcoin/bitcoin/blob/master/src/.clang-format says always in the same line for if, else, for, switch and always in the next line for functions/methods (unless they are defined in one line, which is allowed). That's what I'm doing when I need to touch the lines, but I have to admit I'm not 100% sure. Anyway, style nits...

  15. sipa cross-referenced this on Jul 11, 2015 from issue Continuously limit the memory pool memory consumption by sipa
  16. laanwj merged this on Jul 11, 2015
  17. laanwj closed this on Jul 11, 2015

  18. laanwj referenced this in commit 7cdefb927e on Jul 11, 2015
  19. jonasschnelli commented at 1:48 PM on July 11, 2015: contributor

    Here are also some stats done with a node running this PR: http://bitcoin.jonasschnelli.ch/charts/mempool/

  20. petertodd commented at 1:58 PM on July 11, 2015: contributor

    utACK

  21. in src/txmempool.h:None in 5098c47b24
      58 | @@ -58,6 +59,7 @@ class CTxMemPoolEntry
      59 |      int64_t GetTime() const { return nTime; }
      60 |      unsigned int GetHeight() const { return nHeight; }
      61 |      bool WasClearAtEntry() const { return hadNoDependencies; }
      62 | +    size_t DynamicMemoryUsage() const { return nUsageSize; }
    


    morcos commented at 9:00 PM on July 13, 2015:

    Any reason we're not counting the other member variables? Seems like there are another 53 bytes per CTMemPoolEntry?


    sipa commented at 9:05 PM on July 13, 2015:

    Maybe it should have been called IndirectMemoryUsage. The size of the CTxMemPoolEntry structure itself is accounted for through memusage::DynamicUsage(mapTx), in which the entries are included. That allows for accurately taking alignment and malloc overhead into account.

  22. str4d cross-referenced this on Mar 14, 2017 from issue Bitcoin 0.12 mempool memory usage PRs by str4d
  23. zkbot referenced this in commit 00e59e5935 on Mar 23, 2017
  24. random-zebra cross-referenced this on May 25, 2020 from issue [Core] Implement accurate memory accounting for mempool by random-zebra
  25. random-zebra referenced this in commit 49867086da on Jun 3, 2020
  26. wqking referenced this in commit d1577afc9a on Jan 9, 2021
  27. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:55 UTC