mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Clean up global datastructures at shutdown.
This should make detecting leaks much easier.
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -4750,3 +4750,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;
|
||||
|
||||
Reference in New Issue
Block a user