From aa6b96aaed1d9636881e1b8251ba1124dab114b5 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Mon, 10 Jul 2017 20:41:49 +0530 Subject: [PATCH] Skip memory cleanup when memproportion is not configured Change-Id: I3799d914b5155c37f37bb497ac48e76c1a68761b --- wsd/Admin.cpp | 8 +++++++- wsd/LOOLWSD.cpp | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp index ab99a0598..b4fdfa4ba 100644 --- a/wsd/Admin.cpp +++ b/wsd/Admin.cpp @@ -536,8 +536,14 @@ void Admin::triggerMemoryCleanup(size_t totalMem) { LOG_TRC("Total memory we are consuming (in kB): " << totalMem); // Trigger mem cleanup when we are consuming too much memory (as configured by sysadmin) - const auto memLimit = LOOLWSD::getConfigValue("memproportion", static_cast(80.0)); + const auto memLimit = LOOLWSD::getConfigValue("memproportion", static_cast(0.0)); LOG_TRC("Mem proportion for LOOL configured : " << memLimit); + if (memLimit == 0.0 || _totalSysMem == 0) + { + LOG_TRC("Not configured to do memory cleanup. Skipping memory cleanup."); + return; + } + float memToFreePercentage = 0; if ( (memToFreePercentage = (totalMem/static_cast(_totalSysMem)) - memLimit/100.) > 0.0 ) { diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index b21dd3bc4..3d286f3a9 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -624,7 +624,6 @@ void LOOLWSD::initialize(Application& self) { "lo_jail_subpath", "lo" }, { "server_name", "" }, { "file_server_root_path", "loleaflet/.." }, - { "memproportion", "80.0" }, { "num_prespawn_children", "1" }, { "per_document.max_concurrency", "4" }, { "per_document.idle_timeout_secs", "3600" },