共1条
1/1 1 跳转至页
memPartFree and taskSuspend

Anyone know why memPartFree would ever call taskSuspend?
I am using standard malloc and free pairs, but occasionally I get a suspended task. When I use "tt" to get a trace, it shows free calling memPartFree and then memPartFree calling taskSuspend. If I knew what conditions caused memPartFree to call suspend I might be able to figure out whats happening.
Thanks,
bryan
Hello,
memPartFree and memPartAlloc can both suspend the calling task in cases where there is an allocation error (as long as the task is breakable - see taskLib for information on breakable and non-breakable tasks).
For the case where memPartFree does this, it is usually the result of corruption on your heap. There is a small header just in front of every allocated block that tells the partition library how big the block is, and also contains some pointer information needed to manage the partition. Corrupting one of these headers can cause memPartFree to suspend the task. Also, trying to free memory that was not allocated using memPartAlloc will do this.
If you don't like this behaviour, then you can change the options for the partition (see memPartLib's reference manual for information). Before doing that though, you need to work out what in your code is corrupting the heap! That can be a daunting task, especially since it is likely that the cause of the problem is the code using the block allocated just in front of the one you are trying to free, and the not the code that is being suspended.
You might want to look into some tools that could help you here if you don't find the problem quickly. RTI have a tool that does this (MemScope), and there are other companies out there with these tools too (check on comp.os.vxworks for other suggestions - this comes up on there every now and again).
HTH,
John...
关键词: memPartFree taskSuspend
共1条
1/1 1 跳转至页
回复
打赏帖 | |
---|---|
【OZONE】使用方法总结被打赏20分 | |
【S32K314】芯片启动流程分析被打赏20分 | |
【LP-MSPM0L1306】适配 RT-Thread Nano被打赏20分 | |
今天的咸鱼也是曾经鱼跃龙门的天纵之才,中流击水,浪遏飞舟,粪土当年万户侯,数风流人物,还看今朝,被打赏5分 | |
分享一种检测按键状态的方法被打赏20分 | |
周末总结一下,STM32C0系列的开发经验被打赏50分 | |
【换取手持数字示波器】MicrochipMPLABHarmony框架下定时器配置被打赏20分 | |
【换取手持数字示波器】MicrochipMPLABHarmony框架下PWM配置被打赏20分 | |
【Cortex-M】Systick Timer使用被打赏10分 | |
分享汽车防盗系统的组成与分类(一)被打赏5分 |