Hello,

I'd like to know if it's possible to use malloc in TinyOS ?

In some discussions people says that we can use it but it's not
recommended, since all components share the same memory pool in TinyOS.

But I've seen in some arbitrary precision libraries (like the one of
Relic-toolkit) that they do use malloc to allocate memory for big
integers, since the number of digits vary greatly during arithmetic
calculations.

For example, A and B are 2 integers of 192 bits and I want to implement
A x B = C.
Without malloc, I have to use arrays:

uint16_t A[12];
uint16_t B[12];
uint16_t C[24];

But if in some cases A = 3 and B = 5, there is a huge waste of memory.
On PC I'll use malloc, but in TinyOS, I don't know if it's allowed. If
TinyOS doesn't like malloc, may I just use it in my C functions and call
those functions in my nesC code ?

Best regards.

- Yanbo
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to