D vs. ISRs (interrupt service routines) or Which D language features implictly allocate memory?
Forest Ray
disto at flying-guillotine.com
Fri May 4 23:11:08 PDT 2007
One of D's intended uses is systems level programming. These tasks include implementing ISR (interrupt service routines). Generally speaking it is a very bad idea to allocate memory within an ISR, unless your memory system is reentrant. Many memory managers, especially in the embedded environment, are not reentrant. What language features of D implicitly allocate or resize memory? I assume dynamic arrays, associative arrays, splicing, and concatenation will, but what else? Obviously "new" allocates memory, but that is an explicit request by the programmer, not an implicit request as a side effect of a D language feature. It would be very useful to have the ability to tag a scope of code as "native" or "pure" or "some_better_keyword" so the D compiler would issue an error for any expressions or statements within that scope that implicitly allocate/resized memory. Thoughts, comments?
Forest
More information about the Digitalmars-d
mailing list