Does using memory allocation API such calloc / malloc cause issues on ARM based boards ? I recently faced a issue wherein I used calloc (1024 Bytes) and this buffer was used across many functions in a single source file. I observed the output of a particular function varied randomly when calloc was used, but when I switched over to a fixed array, the issue never showed up. Hence I am wondering if calloc has got any limitations on a small memory footprint board.
Tell me more
×
Electrical Engineering Stack Exchange is a question and answer site for
electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.
|
Assuming you get no error return from the calloc/malloc, the odds are about 9999 to one on that you have a bug, either due to misuse of malloc, misuse of the space so allocated, incorrect memory sections/placement or just because the fixed and malloced buffers will have different addresses. |
|||
|
|
|
This depends on your C library, which in turn depends on your compiler and chosen ARM device. If you are using embedded Linux on ARM with glibc/uclibc then you should have no problems with malloc. If you're programming "on the metal" with a limited libc, you should check the documentation to see how well supported malloc is. You may need to configure the heap in your C startup code. |
|||
|
|