Skip to content

Commit

Permalink
fix a memory leaking issue in mono histogram demo
Browse files Browse the repository at this point in the history
  • Loading branch information
GorgonMeducer committed Dec 19, 2024
1 parent 721076b commit 24569b8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions examples/[template][pico][oled]/pico_template.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,22 @@
<ExecCommand></ExecCommand>
<Expression>0x1000F6C6</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>1</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<ScvdPack>
<Filename>C:\Users\gabriel\AppData\Local\Arm\Packs\ARM\CMSIS-View\1.2.0\EventRecorder\EventRecorder.scvd</Filename>
Expand Down
54 changes: 27 additions & 27 deletions examples/[template][pico][oled]/pico_template.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
</api>
</apis>
<components>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos">
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos">
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
Expand Down Expand Up @@ -553,9 +553,9 @@
</component>
</components>
<files>
<file attr="config" category="sourceC" name="examples\demos\monochrome\SquareDigits.c" version="1.0.1">
<file attr="config" category="sourceC" name="examples\demos\monochrome\SquareDigits.c" version="1.0.2">
<instance index="0">RTE\Acceleration\SquareDigits.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
Expand Down Expand Up @@ -617,97 +617,97 @@
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos/>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_clock.c" version="1.0.1">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_clock.c" version="1.0.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_clock.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_clock.h" version="1.0.1">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_clock.h" version="1.0.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_clock.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_histogram.c" version="1.0.1">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_histogram.c" version="1.1.0">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_histogram.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_histogram.h" version="1.0.1">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_histogram.h" version="1.1.0">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_histogram.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_icon_menu.c" version="1.2.0">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_icon_menu.c" version="1.2.1">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_icon_menu.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_icon_menu.h" version="1.2.0">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_icon_menu.h" version="1.2.1">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_icon_menu.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_list.c" version="1.0.1">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_list.c" version="1.0.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_list.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_list.h" version="1.0.1">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_list.h" version="1.0.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_list.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_loading.c" version="1.2.1">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_loading.c" version="1.2.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_loading.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_loading.h" version="1.2.1">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_loading.h" version="1.2.2">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_loading.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_tracking_list.c" version="1.1.0">
<file attr="config" category="sourceC" name="examples\demos\monochrome\arm_2d_scene_mono_tracking_list.c" version="1.1.1">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_tracking_list.c</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
</targetInfos>
</file>
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_tracking_list.h" version="1.1.0">
<file attr="config" category="header" name="examples\demos\monochrome\arm_2d_scene_mono_tracking_list.h" version="1.1.1">
<instance index="0">RTE\Acceleration\arm_2d_scene_mono_tracking_list.h</instance>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.3" condition="Arm-2D-Demos"/>
<component Cclass="Acceleration" Cgroup="Arm-2D Demos" Csub="Monochrome" Cvendor="ARM" Cversion="1.5.4" condition="Arm-2D-Demos"/>
<package name="Arm-2D" schemaVersion="1.7.37" url="https://www.keil.com/pack/" vendor="ARM" version="9.9.99"/>
<targetInfos>
<targetInfo name="OLED_12864"/>
Expand Down

0 comments on commit 24569b8

Please sign in to comment.