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 force-pushed on Jul 9, 2015
  3. sipa force-pushed on Jul 9, 2015
  4. 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.

  5. laanwj added the label RPC on Jul 10, 2015
  6. Implement accurate memory accounting for mempool 5098c47b24
  7. sipa force-pushed on Jul 10, 2015
  8. 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.
  9. laanwj commented at 3:08 pm on July 10, 2015: member
    Ok, even better.
  10. 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.
  11. 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.
  12. 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…

  13. laanwj merged this on Jul 11, 2015
  14. laanwj closed this on Jul 11, 2015

  15. laanwj referenced this in commit 7cdefb927e on Jul 11, 2015
  16. 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/
  17. petertodd commented at 1:58 pm on July 11, 2015: contributor
    utACK
  18. in src/txmempool.h: 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.
  19. zkbot referenced this in commit 00e59e5935 on Mar 23, 2017
  20. random-zebra referenced this in commit 49867086da on Jun 3, 2020
  21. wqking referenced this in commit d1577afc9a on Jan 9, 2021
  22. MarcoFalke 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: 2024-11-17 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me