Skip to content

Commit a16c6d2

Browse files
Fix error in memory usage calculation (unintended integer division)
1 parent 7466a26 commit a16c6d2

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
@@ -159,12 +159,12 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
159159
const bool log_memory = LogAcceptCategory(BCLog::LEVELDB);
160160
double mem_before = 0;
161161
if (log_memory) {
162-
mem_before = DynamicMemoryUsage() / 1024 / 1024;
162+
mem_before = DynamicMemoryUsage() / 1024.0 / 1024;
163163
}
164164
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
165165
dbwrapper_private::HandleError(status);
166166
if (log_memory) {
167-
double mem_after = DynamicMemoryUsage() / 1024 / 1024;
167+
double mem_after = DynamicMemoryUsage() / 1024.0 / 1024;
168168
LogPrint(BCLog::LEVELDB, "WriteBatch memory usage: db=%s, before=%.1fMiB, after=%.1fMiB\n",
169169
m_name, mem_before, mem_after);
170170
}

0 commit comments

Comments
 (0)