_timer_cancel未释放系统内存空间

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

_timer_cancel未释放系统内存空间

639件の閲覧回数
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 */

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

タグ(2)
0 件の賞賛
返信
1 返信

432件の閲覧回数
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 件の賞賛
返信