my problem is how to use malloc or free function in interrupt function,because the function like malloc() or free() is non_reentrant.But i have to do it in interrupt function to save memory. what shall i do? please help me! i use timer0 to free the memory when memeory is no applied,but after three times,the timero is closed auto. the warning is: multi call to a segment free() or malloc(); i describe my algorithm as below: 1)i make the data to link list firstly; 2)in timer0, i will write the node of the link list to CAN bus buffer, after it ,i will free the node.but the timer0 just work 3 times,when it gets the fourth ,the timer0 is closed auto, what shall i do?? regards!! thanks !!
"Unless you actually need the ability of the list to insert into the middle of existing data" You don't even need malloc to do that! Just have a fixed-size pool of list entries, which are either "free" or "in-use" You can then easily take a "free" entry and "splice" it anywhere into your "in-use" list by simply adjusting the link pointers.