Philip Levis a écrit : > On Feb 22, 2009, at 4:44 AM, Aurélien Francillon wrote: > >> Kevin Klues a écrit : >>> take a look at the TosMallocC component in tinyos-2.x/tos/lib/ >>> tosthreads/system >>> >> The major problem with dynamic memory management on platforms without >> virtual memory (avr,msp...) and limited memory is the risk of memory >> fragmentation. > > I disagree -- the two major problems are failure isolation and heap > corruption. > For the first, one bad software module (e.g., memory > leak) can cause others to fail due to a lack of memory.
Phil, I was referring to major problem that can happen with non buggy software;) Anyway, buggy software on a platform without virtual memory has so many ways to corrupt memory ;) Of course not having dynamic memory allocation of course prevents against memory leaks, and most of the things that I had to implement in TinyOS went fine without it or with memory pools. > For the > second, there's no access protection to prevent a heap from growing > large enough that the stack corrupts it. Well for that one I /kind of/ agree, but I would put it the other way around: it's the stack growth that you can't really limit [1]. And that's completely independent on the fact that a heap is used or not. Worse if you don't have dynamic memory allocation available you tend to allocate statically memory that you might not need, therefore increasing the risk of collision. Aurélien [1] For example when using the avr-libc allocator you can limit heap by defining the the symbol __heap_end at link time (as explained on the avr-libc manual). On the other hand it's perfectly true that there is no easy way to limit the stack to colide with the heap or the bss section if no heap is used. The two ways (that I know) to avoid this are static methods such as John Regehr's stacktool that works given some conditions. Or code instrumentation that adds a dynamic check with a few instructions per function call/return. _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
