diff --git a/ports/run/debug_nitpicker.run b/ports/run/debug_nitpicker.run
index ba8f495629..b1113c4468 100644
--- a/ports/run/debug_nitpicker.run
+++ b/ports/run/debug_nitpicker.run
@@ -63,7 +63,10 @@ set config {
-
+
+
+
+
diff --git a/ports/run/gdb_monitor.run b/ports/run/gdb_monitor.run
index 05104298d8..c5e73328a0 100644
--- a/ports/run/gdb_monitor.run
+++ b/ports/run/gdb_monitor.run
@@ -59,7 +59,10 @@ set config {
-
+
+
+
+
}
diff --git a/ports/run/gdb_monitor_interactive.run b/ports/run/gdb_monitor_interactive.run
index 096cd25d7d..e367b746ab 100644
--- a/ports/run/gdb_monitor_interactive.run
+++ b/ports/run/gdb_monitor_interactive.run
@@ -53,7 +53,10 @@ set config {
-
+
+
+
+
}
diff --git a/ports/run/gdb_monitor_target_config.run b/ports/run/gdb_monitor_target_config.run
index 9dee06d983..75ac1e2a68 100644
--- a/ports/run/gdb_monitor_target_config.run
+++ b/ports/run/gdb_monitor_target_config.run
@@ -58,6 +58,7 @@ set config {
+
diff --git a/ports/src/app/gdb_monitor/main.cc b/ports/src/app/gdb_monitor/main.cc
index 13891388b5..eebd7a82b0 100644
--- a/ports/src/app/gdb_monitor/main.cc
+++ b/ports/src/app/gdb_monitor/main.cc
@@ -65,8 +65,23 @@ int main()
/* extract target node from config file */
Xml_node target_node = config()->xml_node().sub_node("target");
- /* reserve some memory for gdb_monitor and give the rest to the child */
- Number_of_bytes ram_quota = env()->ram_session()->avail() - 2*1024*1024;
+ /*
+ * preserve the configured amount of memory for gdb_monitor and give the
+ * remainder to the child
+ */
+ Number_of_bytes preserved_ram_quota = 0;
+ try {
+ Xml_node preserve_node = config()->xml_node().sub_node("preserve");
+ if (preserve_node.attribute("name").has_value("RAM"))
+ preserve_node.attribute("quantum").value(&preserved_ram_quota);
+ else
+ throw Xml_node::Exception();
+ } catch (...) {
+ PERR("Error: could not find a valid config node");
+ return -1;
+ }
+
+ Number_of_bytes ram_quota = env()->ram_session()->avail() - preserved_ram_quota;
/* start the application */
char *unique_name = filename;