[ECOS] dynamic allocation memory

Andrew Lunn andrew.lunn@ascom.ch
Wed Sep 6 00:30:00 GMT 2000


> Hi, all:
>  
>          I use the malloc function in my device driver, but it seems
> something is wrong with this function. 

You say device driver. Do you mean ISR and DSR? If so, its a bad idea
to use malloc. malloc will need to use some sort of mutex primitive to
protect its data structures from multiple threads executing it
simultaniously. ISR and DSR cannot block so these primitives don't
work. 

Somewhere there is a document which states which functions you can
call in a DSR/ISR. For mempools the try get function will probably
work, but you have to be prepaired for it to return no memory.

        Andrew


More information about the Ecos-discuss mailing list