From 160ca004ac3d649f6a6fb0db4bf95843e2f29086 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Mon, 1 Jul 2024 19:05:57 +0800 Subject: [PATCH] procfs/meminfo: free delaylist for PROTECTED This triggers `mm_free_delaylist()` before dumping status in PROTECTED build, otherwise the `free` command still shows delaylist as `used`. Signed-off-by: Yanfeng Liu --- fs/procfs/fs_procfsmeminfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c index 0e145d2545..eeb0889ded 100644 --- a/fs/procfs/fs_procfsmeminfo.c +++ b/fs/procfs/fs_procfsmeminfo.c @@ -314,6 +314,13 @@ static ssize_t meminfo_read(FAR struct file *filep, FAR char *buffer, buffer += copysize; buflen -= copysize; + /* Trigger reclamation of delay list otherwise they will be + * counted as used, which often confuses people like memory + * leakages. see pull/12817 for more information. + */ + + mm_free_delaylist(entry->heap); + /* Show heap information */ info = mm_mallinfo(entry->heap);