Fix bug in memory usage calculation (unintended integer division).
Fix bug in memory usage calculation (unintended integer division) #12784
pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:calc-error changing 1 files +2 −2-
practicalswift commented at 8:13 AM on March 26, 2018: contributor
- practicalswift renamed this:
Fix error in memory usage calculation (unintended integer division)
Fix bug in memory usage calculation (unintended integer division)
on Mar 26, 2018 - fanquake requested review from eklitzke on Mar 26, 2018
-
promag commented at 1:29 PM on March 27, 2018: member
ACK 490e8be.
-
Fix error in memory usage calculation (unintended integer division) a16c6d23ca
-
in src/dbwrapper.cpp:162 in 490e8be193 outdated
158 | @@ -159,12 +159,12 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync) 159 | const bool log_memory = LogAcceptCategory(BCLog::LEVELDB); 160 | double mem_before = 0; 161 | if (log_memory) { 162 | - mem_before = DynamicMemoryUsage() / 1024 / 1024; 163 | + mem_before = (double)DynamicMemoryUsage() / 1024 / 1024;
laanwj commented at 6:58 PM on March 27, 2018:Wouldn't replacing 1024 with 1024.0 here (and in the other case) have the same effect, but avoid the cast?
practicalswift commented at 8:40 PM on March 27, 2018:@laanwj Absolutely! Now updated. Please re-review :-)
practicalswift force-pushed on Mar 27, 2018eklitzke commented at 11:16 PM on March 27, 2018: contributorACK a16c6d23cadb517f1e728c719a316768ae7b7fe8
I'm really tempted to add formatters for MiB and whatnot as a new format specifier in
tinyformat.h, as we have this logic all over the place.MarcoFalke commented at 11:38 PM on March 27, 2018: memberutACK a16c6d23cadb517f1e728c719a316768ae7b7fe8
eklitzke approvedpracticalswift commented at 2:38 AM on March 28, 2018: contributor@eklitzke Formatters for MiB, etc sounds nice!
fanquake commented at 1:04 PM on March 29, 2018: memberutACK https://github.com/bitcoin/bitcoin/pull/12784/commits/a16c6d23cadb517f1e728c719a316768ae7b7fe8 I've kickstarted Travis.
laanwj commented at 1:11 PM on March 29, 2018: memberI'm really tempted to add formatters for MiB and whatnot as a new format specifier in tinyformat.h, as we have this logic all over the place.
I'd prefer not to make such changes to tinyformat.h locally. Unless you manage to upstream it (https://github.com/c42f/tinyformat), an utility function would be preferable. Although this is arguably so simple I'm not sure how much is gained by that.
laanwj merged this on Mar 29, 2018laanwj closed this on Mar 29, 2018laanwj referenced this in commit e80716d3b3 on Mar 29, 2018Fabcien referenced this in commit 8b217943d2 on Aug 30, 2019jonspock referenced this in commit 967ae8b763 on Dec 8, 2019jonspock referenced this in commit 63aeab11db on Dec 8, 2019jonspock referenced this in commit fc8fc19747 on Dec 8, 2019proteanx referenced this in commit fa4fd9798e on Dec 12, 2019PastaPastaPasta referenced this in commit 5de809e0f8 on Sep 27, 2020PastaPastaPasta referenced this in commit c82688bc90 on Sep 27, 2020PastaPastaPasta referenced this in commit d1e98dca54 on Oct 14, 2020practicalswift deleted the branch on Apr 10, 2021gades referenced this in commit 9bbe35317c on Jun 24, 2021gades referenced this in commit b0bd57c39e on Jan 29, 2022DrahtBot locked this on Aug 16, 2022
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-04-16 15:15 UTC
More mirrored repositories can be found on mirror.b10c.me