[freeRTOS] How to properly delete (from outside) a running task that has a sprite, memory-wise ? #3272
Replies: 1 comment
-
So I managed to do it by simply using direct to task notifications. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I will try to make the question as short as possible.
When a condition is met, a single-shot task ("subtask") is created from another task ("main task"). It does receive a structure with different parameters. The purpose of this subtask is to only create a sprite and push different images (pushImage) with vTaskDelays in between. Once done, the subtask deletes itself (vTaskDelete).
However, if during its execution another condition is met in the main task, the main task should and will attempt to delete the subtask (specifically when in the eBlocked state) only to create it again to display the different data. However, since the previously running subtask didn't finish executing, it couldn't delete the sprite to free the used RAM.
So... how could I free the used RAM by the old sprite in the now deleted subtask from outside (from the main task)?
I'm new to RTOS so maybe there is an easy way to recover the RAM used by the deleted task?
If there isn't one, I guess I would have to implement something inside the subtask that, once it reaches one of the delays, checks
whether the task should continue or delete the sprite and then kill itself...
Thanks
Beta Was this translation helpful? Give feedback.
All reactions