From 7e7c452d4aa60a59fa7779e9aa8d5aa8c9d6be26 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Wed, 23 Jul 2025 19:22:25 +0800 Subject: [PATCH] gio: gmemorymonitorpsi: Fix test error since memory free ratio test can be skipped when performing the test The memory free ratio test can be skipped when we run the test. If proc_override is TRUE and proc path is overridden, the memory free ratio test can be skipped. --- gio/gmemorymonitorpsi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gio/gmemorymonitorpsi.c b/gio/gmemorymonitorpsi.c index b21f504ea..3bddbe21f 100644 --- a/gio/gmemorymonitorpsi.c +++ b/gio/gmemorymonitorpsi.c @@ -178,11 +178,15 @@ g_memory_monitor_low_trigger_cb (GMemoryMonitorPsi *monitor, mem_ratio = g_memory_monitor_base_query_mem_ratio (); - /* if mem free ratio > 0.5, don't signal */ - if (mem_ratio < 0.0) - return G_SOURCE_REMOVE; - else if (mem_ratio > 0.5) - return G_SOURCE_CONTINUE; + /* if the test is running, skip memory ratio test */ + if (!monitor->proc_override) + { + /* if mem free ratio > 0.5, don't signal */ + if (mem_ratio < 0.0) + return G_SOURCE_REMOVE; + if (mem_ratio > 0.5) + return G_SOURCE_CONTINUE; + } g_memory_monitor_base_send_event_to_user (G_MEMORY_MONITOR_BASE (monitor), level_type);