This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: dynamic allocation memory
- To: pyxue at t2-design dot com (pengyu xue)
- Subject: Re: [ECOS] dynamic allocation memory
- From: andrew dot lunn at ascom dot ch (Andrew Lunn)
- Date: Wed, 6 Sep 2000 09:30:16 +0200 (MET DST)
- Cc: ecos-discuss at sourceware dot cygnus dot com
> 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