About malloc_transfer_to_curr_thread

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I'm curious about this malloc_transfer_to_curr_thread because it's an empty define. All malloc is allocated from the global pool (in ThreadX) so i suppose from people who are using ThreadX there is no need for such transfer am i correct? But why is there such define and also used across some WICED App project if the implementation is empty??

0 Likes
1 Reply
Anonymous
Not applicable

malloc_transfer_to_curr_thread() is only used when malloc debugging is enabled. This feature keeps track of which threads malloc memory and which threads free those pieces of memory. If a thread frees a piece of memory malloced by another thread without calling malloc_transfer_to_curr_thread() the malloc debug feature will assert allowing you to verify that the call to free() is valid.