From 7f4de1364452547cfcc0b4809380f3e0a3aa14d1 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Mon, 25 Sep 2023 15:02:46 +0400 Subject: [PATCH] fix(perfmon): fix test_app false-positive memory leak detection --- components/perfmon/test_apps/main/test_perfmon_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/perfmon/test_apps/main/test_perfmon_main.c b/components/perfmon/test_apps/main/test_perfmon_main.c index 656bf5596c..0b65561820 100644 --- a/components/perfmon/test_apps/main/test_perfmon_main.c +++ b/components/perfmon/test_apps/main/test_perfmon_main.c @@ -7,6 +7,7 @@ #include "unity.h" #include "unity_test_runner.h" #include "esp_heap_caps.h" +#include "esp_newlib.h" #define TEST_MEMORY_LEAK_THRESHOLD_DEFAULT 0 static int leak_threshold = TEST_MEMORY_LEAK_THRESHOLD_DEFAULT; @@ -33,6 +34,7 @@ void setUp(void) void tearDown(void) { + esp_reent_cleanup(); //clean up some of the newlib's lazy allocations size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); check_leak(before_free_8bit, after_free_8bit, "8BIT");