You can use a Pool and/or Queue. Those (statically) reserve an amount of memory depending on their size, and you can use and reuse that memory dynamically at runtime. The typical example is a Pool of message_t buffers, which are taken from the Pool, put on the Queue for forwarding, then added back to the pool when they've been sent (see, for example, CtpForwardingEngine).
Michiel From: [email protected] [mailto:[email protected]] On Behalf Of Newlyn Erratt Sent: maandag 30 augustus 2010 15:33 To: [email protected] Subject: [Tinyos-help] Dynamic memory All: I've been looking through the archives for a few days trying to figure out the best solution to this problem. I know that malloc should not be used. I also know that there are some available dynamic memory implementations. Notable, I've seen TinyAlloc mentioned (assuming it was strictly TinyOS 1.x though) and I've seen the Malloc that is provided in the TOSThreads system. My situation is this: I am developing a protocol and have several buffer which need varying amounts of memory based on the users configuration. I would like an implementation that would allow me to define a memory pool where I may allocate memory freely to the buffers. The problem is two-fold. I'm not entirely sure if this is the best solution even though it seems attractive: does anyone have any other suggestions that aren't too limiting? I'm not sure what the best implementation would be for this. I've seen it mentioned that there are several options for dynamic memory but I wanted some opinions on what the best solutions are. Thanks for any help, Newlyn
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
