Bob Ammerman wrote: > Wouter van Ooijen replied: >> Note that the three examples you cite do not use 'general' >> malloc/free-style dynamic memory. Did you use a compiler-provided >> (C-style) malloc at all? I understand that you certainly did not use >> free. >> >> In all three cases you took explicit action to avoid fragmentation. >> Except for the double-pointer example approach one could argue that >> (in the other two) you don't use dynamic memory at all: you might as >> well have used one or more statically allocated arrays and hand out >> (and take back) array entries. > > Absolutely. Although in the C++ case the application 'thinks' it is > using normal 'new' and 'delete'. I just replaced the 'new handler', > which is actually supported by the C++ standard, IIRC. This is exactly my point. When using something like the heap, one needs to plan that carefully -- as carefully as using static memory, and except for the syntax, it often isn't that different from using static arrays -- just hidden under several layers of syntax. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist