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. Contiki has a nice trick with double pointers to access dynamically allocated memory. The drawback is that every access must be performed through a macro that performs double dereference, additionally no "intermediate pointer" should be saved, those could be corrupted at anytime if memory defragmentation occurs. There is are a few blog posts here that gives a good explanation of the problem and the solution in Contiki: http://freaklabs.org/index.php/Blog/FreakZ/DevJournal-Non-Fragmenting-Dynamic-Memory-Allocation.html http://freaklabs.org/index.php/Blog/FreakZ/DevJournal-Finished-the-switch-to-dynamic-allocation-and-managed-memory.html http://freaklabs.org/index.php/Blog/FreakZ/DevJournal-Ok-Really...the-dynamic-allocation-and-managed-memory-is-implemented.html The main advantage is that the actual memory blocks can be reorganized without corrupting references to those memory regions. It seems that there is no support for this kind of feature in TinyOS yet, I guess that this could be implemented in the nesc compiler in order to provide transparent memory access, instead of using macros? Would this be feasible ? Best, Aurélien _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
