Skip to content

Commit e80716d

Browse files
committed
Merge #12784: Fix bug in memory usage calculation (unintended integer division)
a16c6d2 Fix error in memory usage calculation (unintended integer division) (practicalswift) Pull request description: Fix bug in memory usage calculation (unintended integer division). Tree-SHA512: 2df1f00c5282581c61e1fd55fef3fabc02161b5a47d8f1795b05d57117245ff3d1ee861dd689eebe0185f28176cea428007e799d5c43a1ce5dc704123439f967
2 parents cd99e5b + a16c6d2 commit e80716d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dbwrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
184184
const bool log_memory = LogAcceptCategory(BCLog::LEVELDB);
185185
double mem_before = 0;
186186
if (log_memory) {
187-
mem_before = DynamicMemoryUsage() / 1024 / 1024;
187+
mem_before = DynamicMemoryUsage() / 1024.0 / 1024;
188188
}
189189
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
190190
dbwrapper_private::HandleError(status);
191191
if (log_memory) {
192-
double mem_after = DynamicMemoryUsage() / 1024 / 1024;
192+
double mem_after = DynamicMemoryUsage() / 1024.0 / 1024;
193193
LogPrint(BCLog::LEVELDB, "WriteBatch memory usage: db=%s, before=%.1fMiB, after=%.1fMiB\n",
194194
m_name, mem_before, mem_after);
195195
}

0 commit comments

Comments
 (0)