Fix memory leak / reduce mnw memory
- mapSeenMasternodePing & mapSeenMasternodeBroadcast were not getting cleaned, so the pinging of 3000 masternode was accumulating over time. This patch has the clean clean the lists every few minutes and removes anything older than 20 minutes for pings and 2.5 hours for broadcasts. - v48
This commit is contained in:
parent
099e412dba
commit
402d821529
@ -3,7 +3,7 @@ AC_PREREQ([2.60])
|
|||||||
define(_CLIENT_VERSION_MAJOR, 0)
|
define(_CLIENT_VERSION_MAJOR, 0)
|
||||||
define(_CLIENT_VERSION_MINOR, 12)
|
define(_CLIENT_VERSION_MINOR, 12)
|
||||||
define(_CLIENT_VERSION_REVISION, 0)
|
define(_CLIENT_VERSION_REVISION, 0)
|
||||||
define(_CLIENT_VERSION_BUILD, 47)
|
define(_CLIENT_VERSION_BUILD, 48)
|
||||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||||
define(_COPYRIGHT_YEAR, 2015)
|
define(_COPYRIGHT_YEAR, 2015)
|
||||||
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash])
|
AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash])
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 12
|
#define CLIENT_VERSION_MINOR 12
|
||||||
#define CLIENT_VERSION_REVISION 0
|
#define CLIENT_VERSION_REVISION 0
|
||||||
#define CLIENT_VERSION_BUILD 47
|
#define CLIENT_VERSION_BUILD 48
|
||||||
|
|
||||||
//! Set to true for release, false for prerelease or test build
|
//! Set to true for release, false for prerelease or test build
|
||||||
#define CLIENT_VERSION_IS_RELEASE true
|
#define CLIENT_VERSION_IS_RELEASE true
|
||||||
|
@ -598,7 +598,7 @@ void CMasternodePayments::CleanPaymentList()
|
|||||||
if(chainActive.Tip() == NULL) return;
|
if(chainActive.Tip() == NULL) return;
|
||||||
|
|
||||||
//keep up to five cycles for historical sake
|
//keep up to five cycles for historical sake
|
||||||
int nLimit = std::max(((int)mnodeman.size())*5, 1000);
|
int nLimit = std::max(((int)mnodeman.size())*2, 1000);
|
||||||
|
|
||||||
std::map<uint256, CMasternodePaymentWinner>::iterator it = mapMasternodePayeeVotes.begin();
|
std::map<uint256, CMasternodePaymentWinner>::iterator it = mapMasternodePayeeVotes.begin();
|
||||||
while(it != mapMasternodePayeeVotes.end()) {
|
while(it != mapMasternodePayeeVotes.end()) {
|
||||||
|
@ -324,6 +324,26 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove expired mapSeenMasternodeBroadcast
|
||||||
|
map<uint256, CMasternodeBroadcast>::iterator it3 = mapSeenMasternodeBroadcast.begin();
|
||||||
|
while(it3 != mapSeenMasternodeBroadcast.end()){
|
||||||
|
if((*it3).second.sigTime < GetTime()-(MASTERNODE_MIN_MNP_SECONDS*2)){
|
||||||
|
mapSeenMasternodeBroadcast.erase(it3++);
|
||||||
|
} else {
|
||||||
|
++it3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove expired mapSeenMasternodePing
|
||||||
|
map<uint256, CMasternodePing>::iterator it4 = mapSeenMasternodePing.begin();
|
||||||
|
while(it4 != mapSeenMasternodePing.end()){
|
||||||
|
if((*it4).second.sigTime < GetTime()-(MASTERNODE_REMOVAL_SECONDS*2)){
|
||||||
|
mapSeenMasternodePing.erase(it4++);
|
||||||
|
} else {
|
||||||
|
++it4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMasternodeMan::Clear()
|
void CMasternodeMan::Clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user