diff --git a/lib/App/common/hardwareManager.cpp b/lib/App/common/hardwareManager.cpp index 5a21ccfc..e426cde1 100644 --- a/lib/App/common/hardwareManager.cpp +++ b/lib/App/common/hardwareManager.cpp @@ -64,6 +64,8 @@ hardwareManager::hardwareManager( bool cold_start ){ m_nServerNodeID = 0; m_nServerID = 0; m_nSiteID = 0; + + m_bCacheCleanCounter = 3; memset( &m_sSYS_INFO, 0, sizeof(DBC_SYS_INFO) ); strncpy( m_sSYS_INFO.SW_INFO, _BUILD_STRING_, 128 ); @@ -371,7 +373,11 @@ bool hardwareManager::validate( void ){ if ( !RetVal ) { LOG_ERROR("Memory Consumption too BIG!"); }; - }; + }; + if ( m_bCacheCleanCounter == 0 ) { + LOG_ERROR("System Cache Fas Too Big Too Many Times!"); + RetVal = false; + }; return RetVal; }; @@ -1424,6 +1430,7 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){ */ system( "echo 3 > /proc/sys/vm/drop_caches" ); + if( m_bCacheCleanCounter ) m_bCacheCleanCounter--; }; } else { LOG_ERROR("Error while getting System Info!"); diff --git a/lib/App/common/hardwareManager.h b/lib/App/common/hardwareManager.h index 3924152c..2b4b1fa6 100644 --- a/lib/App/common/hardwareManager.h +++ b/lib/App/common/hardwareManager.h @@ -39,6 +39,8 @@ class hardwareManager{ PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name ); void clearAllResources( void ); + + uint8_t m_bCacheCleanCounter; public: virtual ~hardwareManager(); static hardwareManager * getInstance( bool cold_start = true );