diff --git a/modules/ripple_app/ledger/Ledger.cpp b/modules/ripple_app/ledger/Ledger.cpp index 72db0fdede..ce282deab4 100644 --- a/modules/ripple_app/ledger/Ledger.cpp +++ b/modules/ripple_app/ledger/Ledger.cpp @@ -172,6 +172,43 @@ Ledger::Ledger (const std::string& rawLedger, bool hasPrefix) : initializeFees (); } +Ledger::~Ledger () +{ + double txDeleteSeconds = 0; + + { + int64 const startTime (Time::getHighResolutionTicks ()); + + mTransactionMap.reset (); + + txDeleteSeconds = Time::highResolutionTicksToSeconds ( + Time::getHighResolutionTicks () - startTime); + } + + double acctDeleteSeconds = 0; + + { + int64 const startTime (Time::getHighResolutionTicks ()); + + mAccountStateMap.reset (); + + acctDeleteSeconds = Time::highResolutionTicksToSeconds ( + Time::getHighResolutionTicks () - startTime); + } + + if (txDeleteSeconds >= 1) + { + WriteLog (lsWARNING, Ledger) << "mTransactionMap took " << + String (txDeleteSeconds, 1) << " seconds to destroy."; + } + + if (acctDeleteSeconds >= 1) + { + WriteLog (lsWARNING, Ledger) << "mAccountStateMap took " << + String (acctDeleteSeconds, 1) << " seconds to destroy."; + } +} + void Ledger::setImmutable () { updateHash (); diff --git a/modules/ripple_app/ledger/Ledger.h b/modules/ripple_app/ledger/Ledger.h index 8f5a813766..d278c58a9e 100644 --- a/modules/ripple_app/ledger/Ledger.h +++ b/modules/ripple_app/ledger/Ledger.h @@ -80,6 +80,8 @@ public: Ledger (Ledger & target, bool isMutable); // snapshot + ~Ledger (); + static Ledger::pointer getSQL (const std::string & sqlStatement); static Ledger::pointer getSQL1 (SqliteStatement*); static void getSQL2 (Ledger::ref);