From 24569b8e0bb995f2a85d248711c24eb6bbd538de Mon Sep 17 00:00:00 2001 From: Gabriel Wang Date: Thu, 19 Dec 2024 23:41:50 +0000 Subject: [PATCH] fix a memory leaking issue in mono histogram demo --- .../arm_2d_scene_mono_histogram.c | 3 +- .../RTE/Acceleration/arm_2d_scene_mono_list.c | 25 --------- .../arm_2d_scene_mono_tracking_list.c | 25 --------- .../pico_template.uvoptx | 16 ++++++ .../pico_template.uvprojx | 54 +++++++++---------- 5 files changed, 45 insertions(+), 78 deletions(-) diff --git a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_histogram.c b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_histogram.c index b9a86236..324bba68 100644 --- a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_histogram.c +++ b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_histogram.c @@ -133,6 +133,8 @@ static void __on_scene_mono_histogram_depose(arm_2d_scene_t *ptScene) *ptItem = 0; } + histogram_depose(&this.tHistogram); + if (!this.bUserAllocated) { __arm_2d_free_scratch_memory(ARM_2D_MEM_TYPE_UNSPECIFIED, ptScene); } @@ -207,7 +209,6 @@ IMPL_PFB_ON_DRAW(__pfb_draw_scene_mono_histogram_handler) arm_2d_canvas(ptTile, __top_canvas) { - arm_2d_align_centre(__top_canvas, 128 - 16, 64 - 8) { arm_2d_layout(__centre_region) { diff --git a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_list.c b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_list.c index 539fed3f..abe76c83 100644 --- a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_list.c +++ b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_list.c @@ -92,31 +92,6 @@ struct { /*============================ PROTOTYPES ====================================*/ /*============================ LOCAL VARIABLES ===============================*/ - -/*! define dirty regions */ -IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions, static) - - /* a dirty region to be specified at runtime*/ - ADD_REGION_TO_LIST(s_tDirtyRegions, - 0 /* initialize at runtime later */ - ), - - /* add the last region: - * it is the top left corner for text display - */ - ADD_LAST_REGION_TO_LIST(s_tDirtyRegions, - .tLocation = { - .iX = 0, - .iY = 0, - }, - .tSize = { - .iWidth = 0, - .iHeight = 8, - }, - ), - -END_IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions) - /*============================ IMPLEMENTATION ================================*/ static void __on_scene_mono_list_load(arm_2d_scene_t *ptScene) diff --git a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_tracking_list.c b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_tracking_list.c index 99453afd..d849eca6 100644 --- a/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_tracking_list.c +++ b/examples/[template][pico][oled]/RTE/Acceleration/arm_2d_scene_mono_tracking_list.c @@ -92,31 +92,6 @@ struct { /*============================ PROTOTYPES ====================================*/ /*============================ LOCAL VARIABLES ===============================*/ - -/*! define dirty regions */ -IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions, static) - - /* a dirty region to be specified at runtime*/ - ADD_REGION_TO_LIST(s_tDirtyRegions, - 0 /* initialize at runtime later */ - ), - - /* add the last region: - * it is the top left corner for text display - */ - ADD_LAST_REGION_TO_LIST(s_tDirtyRegions, - .tLocation = { - .iX = 0, - .iY = 0, - }, - .tSize = { - .iWidth = 0, - .iHeight = 8, - }, - ), - -END_IMPL_ARM_2D_REGION_LIST(s_tDirtyRegions) - /*============================ IMPLEMENTATION ================================*/ static void __on_scene_mono_tracking_list_load(arm_2d_scene_t *ptScene) diff --git a/examples/[template][pico][oled]/pico_template.uvoptx b/examples/[template][pico][oled]/pico_template.uvoptx index ec1acf70..b0ca6919 100644 --- a/examples/[template][pico][oled]/pico_template.uvoptx +++ b/examples/[template][pico][oled]/pico_template.uvoptx @@ -165,6 +165,22 @@ 0x1000F6C6 + + 1 + 0 + 1 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\main.c + + +
C:\Users\gabriel\AppData\Local\Arm\Packs\ARM\CMSIS-View\1.2.0\EventRecorder\EventRecorder.scvd diff --git a/examples/[template][pico][oled]/pico_template.uvprojx b/examples/[template][pico][oled]/pico_template.uvprojx index 20a2bf29..9c504d1e 100644 --- a/examples/[template][pico][oled]/pico_template.uvprojx +++ b/examples/[template][pico][oled]/pico_template.uvprojx @@ -443,7 +443,7 @@ - + @@ -553,9 +553,9 @@ - + RTE\Acceleration\SquareDigits.c - + @@ -617,97 +617,97 @@ - + RTE\Acceleration\arm_2d_scene_mono_clock.c - + - + RTE\Acceleration\arm_2d_scene_mono_clock.h - + - + RTE\Acceleration\arm_2d_scene_mono_histogram.c - + - + RTE\Acceleration\arm_2d_scene_mono_histogram.h - + - + RTE\Acceleration\arm_2d_scene_mono_icon_menu.c - + - + RTE\Acceleration\arm_2d_scene_mono_icon_menu.h - + - + RTE\Acceleration\arm_2d_scene_mono_list.c - + - + RTE\Acceleration\arm_2d_scene_mono_list.h - + - + RTE\Acceleration\arm_2d_scene_mono_loading.c - + - + RTE\Acceleration\arm_2d_scene_mono_loading.h - + - + RTE\Acceleration\arm_2d_scene_mono_tracking_list.c - + - + RTE\Acceleration\arm_2d_scene_mono_tracking_list.h - +