mirror of
https://github.com/Xahau/xahaud.git
synced 2026-06-06 10:16:35 +00:00
fix: add actual transaction data to RWDB memory usage calculations
The existing memory usage functions only counted structural overhead (sizeof of containers and pointers) but missed the actual transaction and metadata blob sizes. This caused severe underreporting - showing KBs when actually using MBs or GBs. Changes: - Keep existing structural overhead calculations - Add actual transaction/metadata serialized data sizes - Use transactionMap_ as single source to avoid double-counting - Add MAP_NODE_OVERHEAD constant for red-black tree nodes (~40 bytes each) - Use vector::capacity() instead of size() for actual allocated memory - Include ledger's transaction map node overhead in ledger calculations - Change internal calculation to uint64_t to prevent overflow - Add clear comments explaining what each section measures These improvements provide much more accurate memory reporting for monitoring and diagnostic purposes.
This commit is contained in:
@@ -542,9 +542,9 @@ public:
|
||||
auto newLedgerKB = sqliteDb->getKBUsedLedger();
|
||||
auto newTxKB = sqliteDb->getKBUsedTransaction();
|
||||
|
||||
BEAST_EXPECT(newAllKB == 1);
|
||||
BEAST_EXPECT(newAllKB == 2);
|
||||
BEAST_EXPECT(newLedgerKB == 0);
|
||||
BEAST_EXPECT(newTxKB == 0);
|
||||
BEAST_EXPECT(newTxKB == 1);
|
||||
|
||||
// Test database closure operations (should not throw)
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user