These give me a great help to understand these issues of dynamic memory, and for that thank you! I have just one more question:
In "tinyos-programming.pdf" is said: "If your application requirements necessitate a dynamic memory pool, encapsulate it in a component and try to limit the set of users." -- This means that any code that uses dynamic memory should be done in a separate component? I see no relevance in this ... : S On Sun, Dec 20, 2009 at 9:37 PM, Faisal Aslam < [email protected]> wrote: > Dear Ricardo, > > > First of all thank you for your answer. > > > > Is slower because it has to find a contiguous space of memory large > enough > > to reserve, or is there another reason(s)? > > May be someone with more experience in C can give better reply on this. > However, it is slower for sure. It takes CPU cycle to manage memory, i.e. > to allocate and deallocate space. > > > If it is possible in all versions of TinyOS, why in some of the > literature > > says it is not possible? : S > > I do not know any literature that says it is not allowed to use dynamic > memory in TinyOS. One can write plan C code in TinyOS and C allows dynamic > memory allocation in MSP430 and AVR microcontroller. I know it because we > have done that. > > best regards, > > -- > Faisal Aslam > > PhD Student > University of Freiburg > http://cone.informatik.uni-freiburg.de/people/aslam/ > > On Fri, Dec 18, 2009 at 5:38 PM, Faisal Aslam < > > [email protected]> wrote: > > > >> Dear Ricardo, > >> Here is my take on your questions. See inline. > >> > >> > >> Ricardo . wrote: > >> > >>> > >>> Dear all, > >>> > >>> I need your help to clear up a question: my application needs dynamic > >>> memory, and literature that I've found some say it is not possible, > >>> other > >>> say it's possible but it is not efficient. > >>> > >>> My questions are: > >>> > >>> 1 - Which version of TinyOS is possible to use dynamic memory? > >>> > >> In all the versions. You can write pure C code in TinyOS and all > >> compilers > >> I know support dynamic memory. > >> > >> 2 - Any mote supports dynamic memory? > >>> > >> All motes. > >> > >> 3 - What is the reason for dynamic memory is not efficient? > >>> 4 - Using dynamic memory greatly affects the efficiency, or is almost > >>> imperceptible? > >>> > >> The answer of both question 3 and 4 is as follows. Dynamic memory means > >> that you cannot predict memory usage at compile time and could go out of > >> memory easily. You have to deallocate memory yoursef carefully. There > >> are > >> more chances of complicated errors. The allocating and deallocating > >> memory > >> is slow process and your code will execute slower. The static memory > >> allocation is much more safer and faster. > >> You can also program your motes using Java. It has automatic garbage > >> collection and will give you "out of memory" error. It is usually safer > >> to > >> use Java then C. Unlike C in Java you cannot have segmentation fault. > >> You > >> can use data structure like Vector that will grow dynamically etc. > >> > >> > >>> > >>> I wonder if anyone knows explain some of these issues (preferably all > >>> =)), > >>> or if anyone know of any literature where I can get answers. > >>> > >>> Thankyou very much, > >>> -- > >>> Ricardo > >>> > >> > >> -- > >> Faisal Aslam > >> > >> University of Freiburg > >> http://cone.informatik.uni-freiburg.de/people/aslam/ > >> > >> > > _______________________________________________ > > Tinyos-help mailing list > > [email protected] > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > > >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
