[Tinyos-help] Re: Dynamic Memory Allocation

AIGroup gruppodinfo at gmail.com
Tue Jan 29 02:49:29 PST 2008


I believed...
I'm using TinyOS 2.0.
I tried to compile and use these statements in my code:
    int *x;
    x=(int *)(malloc(sizeof(int)));
    *x=4;
    dbg("BlinkC", "Timer 0 fired @ %s.\nContenuto di x = %d\n",
sim_time_string(), *x);

and all works well!
So...why using malloc() is dangerous? (as I read in some past posts)
Thanks for your help


2008/1/29, AIGroup <gruppodinfo at gmail.com>:
>
> Hi all,
>
> I'm using Micaz for my project and i need to allocate memory at runtime.
> I know that TinyOS doesn't support functions as malloc().
> So, how can I solve this problem?
> Thanks in advance
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080129/7b7b4b0b/attachment.htm


More information about the Tinyos-help mailing list