aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-04-02 10:00:31 -0700
committerGavin Andresen <gavinandresen@gmail.com>2013-04-02 10:00:31 -0700
commitd8aae1ce1deea764f9ab61bbd210a3963f650d96 (patch)
tree0a7fa2798875db0c2914186696dcae903051f429 /src/main.cpp
parent06db61f09e4201a17ef169754ac374a2b7a37316 (diff)
parent3427517d507a938074a50fa8ea6dfe3d13bef357 (diff)
downloadbitcoin-d8aae1ce1deea764f9ab61bbd210a3963f650d96.tar.xz
Merge pull request #2420 from sipa/globclean
Global cleanups
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b29091b4fe..60593c0d5f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4764,3 +4764,29 @@ uint64 CTxOutCompressor::DecompressAmount(uint64 x)
}
return n;
}
+
+
+class CMainCleanup
+{
+public:
+ CMainCleanup() {}
+ ~CMainCleanup() {
+ // block headers
+ std::map<uint256, CBlockIndex*>::iterator it1 = mapBlockIndex.begin();
+ for (; it1 != mapBlockIndex.end(); it1++)
+ delete (*it1).second;
+ mapBlockIndex.clear();
+
+ // orphan blocks
+ std::map<uint256, CBlock*>::iterator it2 = mapOrphanBlocks.begin();
+ for (; it2 != mapOrphanBlocks.end(); it2++)
+ delete (*it2).second;
+ mapOrphanBlocks.clear();
+
+ // orphan transactions
+ std::map<uint256, CDataStream*>::iterator it3 = mapOrphanTransactions.begin();
+ for (; it3 != mapOrphanTransactions.end(); it3++)
+ delete (*it3).second;
+ mapOrphanTransactions.clear();
+ }
+} instance_of_cmaincleanup;