Hi,

Malloc might work in a simulation environment, but it does not work on the physical motes. So if you want to program real hardware you'll have to find a way to avoid malloc.

Cheers,
Urs


AIGroup wrote:
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 <[EMAIL PROTECTED]>:
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
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to