_timer_cancel未释放系统内存空间

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_timer_cancel未释放系统内存空间

507 Views
hugolee
Contributor I

Hi,

在使用MQX定时器组件时,我发现在申请定时器时是需要申请系统内存空间的,但如果取消定时器的任务是Timer Task时,则不会删除定时器队列中的阶段也不会释放系统内存空间。如下:

ti_cancl.c:

timer_entry_ptr->VALID = 0;
timer_entry_ptr->ID = 0;
if (kernel_data->ACTIVE_PTR != timer_component_ptr->TIMER_TD_PTR) {
_QUEUE_REMOVE(queue_ptr, timer_entry_ptr);
_mem_free(timer_entry_ptr);
_lwsem_post(&timer_component_ptr->TIMER_ENTRIES_LWSEM);
} /* Endif */

这样做不会造成内存泄漏吗?

Tags (2)
0 Kudos
1 Reply

300 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Hugo:

Maybe the system memory  you mentioned is timer_component created with _timer_create_component

pastedImage_3.png

This memory is installed into Kernel, and can be used by other timer tasks too.

Regards

Daniel

0 Kudos