Optimized std::map to reduce memory usage

This commit is contained in:
Luca Deri 2024-02-21 13:40:42 +01:00
parent 73df55aeac
commit d31a57c573
8 changed files with 57 additions and 37 deletions

View file

@ -36,12 +36,14 @@ class InterfaceMemberAlertableEntity : public OtherAlertableEntity {
~InterfaceMemberAlertableEntity() {
/* Decrease interface number of engaged alerts on the interface */
std::map<std::string, Alert>::const_iterator alert_it;
std::map<u_int32_t /* std::string */, Alert>::const_iterator alert_it;
engaged_alerts_lock.wrlock(__FILE__, __LINE__);
for (u_int p = 0; p < MAX_NUM_PERIODIC_SCRIPTS; p++)
for (alert_it = engaged_alerts[p].begin();
alert_it != engaged_alerts[p].end(); ++alert_it)
for (alert_it = engaged_alerts[p].begin(); alert_it != engaged_alerts[p].end(); ++alert_it)
decNumAlertsEngaged(Utils::mapScoreToSeverity(alert_it->second.score));
engaged_alerts_lock.unlock(__FILE__, __LINE__);
};
};