diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-06-11 20:02:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-11 20:02:37 +0800 |
commit | 43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1 (patch) | |
tree | 048e789436a03a641d319ac431d37d980e9c6e27 | |
parent | b487bdf0ba21f1877501a9bdd97f84701273e022 (diff) | |
parent | a3267ed9296b08ec170b239e519cb5aff6ee25f0 (diff) | |
download | dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar.gz dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar.bz2 dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar.lz dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar.xz dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.tar.zst dexon-43b940ec5a8a1749ad6e6ffe51b7231fb1fa15d1.zip |
Merge pull request #16945 from karalabe/triedb-spurious-warning
trie: don't report the root flushlist as an alloc
-rw-r--r-- | trie/database.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/trie/database.go b/trie/database.go index 76a6cf79d..468c139df 100644 --- a/trie/database.go +++ b/trie/database.go @@ -297,7 +297,7 @@ func (db *Database) Cap(limit common.StorageSize) error { // db.nodesSize only contains the useful data in the cache, but when reporting // the total memory consumption, the maintenance metadata is also needed to be // counted. For every useful node, we track 2 extra hashes as the flushlist. - size := db.nodesSize + common.StorageSize(len(db.nodes)*2*common.HashLength) + size := db.nodesSize + common.StorageSize((len(db.nodes)-1)*2*common.HashLength) // If the preimage cache got large enough, push to disk. If it's still small // leave for later to deduplicate writes. @@ -512,6 +512,6 @@ func (db *Database) Size() (common.StorageSize, common.StorageSize) { // db.nodesSize only contains the useful data in the cache, but when reporting // the total memory consumption, the maintenance metadata is also needed to be // counted. For every useful node, we track 2 extra hashes as the flushlist. - var flushlistSize = common.StorageSize(len(db.nodes) * 2 * common.HashLength) + var flushlistSize = common.StorageSize((len(db.nodes) - 1) * 2 * common.HashLength) return db.nodesSize + flushlistSize, db.preimagesSize } |