You need to return the same pointer that you get in receive(TOS_MsgPtr m),
the system will recycle it. There isn't any way for you to free it
yourself. Perhaps you can run your program under TOSSIM or something
so your can trace memory usage to see if you've really got a leak.
Otherwise you could have a runaway pointer or something that wouldn't
crash immediately...
MS

Munaretto, Daniel wrote:
Dear all,
i discover a really strange behavior in my application. I repeat more times my code, and after some experiments the motes break down.
So there is a memory problem.
But i'm sure i free all the memory i allocate during the code. I'm using only a buffer and i re-use it all 
the times, instead i allocate memory with "calloc()" only for creating a chain which i delete at 
the end of each simulation with the "free" command and then i give "NULL" to the pointers.
So i don't understand where i lose memory each time i re-run the program 
(without re-booting the motes). i'm in tinyos 1.1.15,micaz motes.
I'm using the FlashBridge interface because i'm working on the flash.
I'm supposing that, may be, the problem is in the way Tinyos handles the packets 
received. For example, in the function "event TOS_MsgPtr Receive.receive(TOS_MsgPtr 
m)", before returning m, do i have to free it?But i can see it's wrong to do..
Please, if anyone knows where i have to find the waste of memory (may be some interfaces)...any helps will be really appreciated
thanks very much
cheers
Daniele

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to