"In the wifi lib, when receiving packets and under a few other circumstances, the Wifi lib in its present form performs a malloc call from within the Wifi_Timer() call, and can also perform a malloc call from within the Wifi_Sync function, for FIFO messages - the only problem is both of those calls are often within interrupts, so the possibility of pre-empting a malloc in 'normal' code (which, malloc is also called in printf, for reference) is nontrivial. The only problem with this, is that malloc wasnÂ’t really designed for that, so a malloc call preempting another malloc call can cause fatal problems, corrupt the heap, or crash your code.
There are a few ways to deal with this problem, the first of which is to use a seperate heap allocator, which is the solution I'll be incorperating into 0.3b. Those of you in the know can also implement some form of locking, wrapping allocation calls in interrupt disabling code, or something similar. Another thing to make note of is this modification will cause the wifi lib to eat up a specific amount of memory on startup (which will be user selectable, probably set to 64k or 128k for a default) - there will also be the option to disable the new memory management if you have your own solution; which will be an extra flag that will be necessary to use in the init call!"
Via Stephen\'sWeblog
"In the wifi lib, when receiving packets and under a few other circumstances, the Wifi lib in its present form performs a malloc call from within the Wifi_Timer() call, and can also perform a malloc call from within the Wifi_Sync function, for FIFO messages - the only problem is both of those calls are often within interrupts, so the possibility of pre-empting a malloc in 'normal' code (which, malloc is also called in printf, for reference) is nontrivial. The only problem with this, is that malloc wasnÂ’t really designed for that, so a malloc call preempting another malloc call can cause fatal problems, corrupt the heap, or crash your code.
There are a few ways to deal with this problem, the first of which is to use a seperate heap allocator, which is the solution I'll be incorperating into 0.3b. Those of you in the know can also implement some form of locking, wrapping allocation calls in interrupt disabling code, or something similar. Another thing to make note of is this modification will cause the wifi lib to eat up a specific amount of memory on startup (which will be user selectable, probably set to 64k or 128k for a default) - there will also be the option to disable the new memory management if you have your own solution; which will be an extra flag that will be necessary to use in the init call!"
Via Stephen\'sWeblog
