From 77a313ff760e97216e4acef325b4a1149e5238fe Mon Sep 17 00:00:00 2001
From: Nikolaj Bjorner <nbjorner@microsoft.com>
Date: Mon, 8 Aug 2022 11:26:18 +0300
Subject: [PATCH] redo #6242

revert to byte based high watermark
add mb based high watermark
---
 src/util/env_params.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/util/env_params.cpp b/src/util/env_params.cpp
index db2c9a890..80a1195aa 100644
--- a/src/util/env_params.cpp
+++ b/src/util/env_params.cpp
@@ -28,7 +28,10 @@ void env_params::updt_params() {
     enable_warning_messages(p.get_bool("warning", true));
     memory::set_max_size(megabytes_to_bytes(p.get_uint("memory_max_size", 0)));
     memory::set_max_alloc_count(p.get_uint("memory_max_alloc_count", 0));
-    memory::set_high_watermark(megabytes_to_bytes(p.get_uint("memory_high_watermark", 0)));
+    memory::set_high_watermark(p.get_uint("memory_high_watermark", 0));
+    unsigned mb = p.get_uint("memory_high_watermark_mb", 0);
+    if (mb > 0)
+        memory::set_high_watermark(megabytes_to_bytes(mb));    
 }
 
 void env_params::collect_param_descrs(param_descrs & d) {
@@ -36,5 +39,6 @@ void env_params::collect_param_descrs(param_descrs & d) {
     d.insert("warning", CPK_BOOL, "enable/disable warning messages", "true");
     d.insert("memory_max_size", CPK_UINT, "set hard upper limit for memory consumption (in megabytes), if 0 then there is no limit", "0");
     d.insert("memory_max_alloc_count", CPK_UINT, "set hard upper limit for memory allocations, if 0 then there is no limit", "0");
-    d.insert("memory_high_watermark", CPK_UINT, "set high watermark for memory consumption (in megabytes), if 0 then there is no limit", "0");
+    d.insert("memory_high_watermark", CPK_UINT, "set high watermark for memory consumption (in bytes), if 0 then there is no limit", "0");
+    d.insert("memory_high_watermark_mb", CPK_UINT, "set high watermark for memory consumption (in megabytes), if 0 then there is no limit", "0");
 }