Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

C/C++ • Re: Discrepancy between datatypes performance

$
0
0
Well I think that it's a problem with memory allocation. I Know that they work on a new version which will get the correct memory available. Maybe that will fix this problem

I could simply fix the bug by using malloc for all your arr_* or move your arr_*[ARR_SIZE] outside the main() function.
If you want to allocate large arrays on the Pico's stack, I think you need a custom linker script to make the stack bigger.

Note on larger systems running Linux increasing the stack size is done using virtual addressing up to the limits set by rlimit. On the Pico the stack is small, does not grow and if it overflows into the heap area any local variables can get overwritten when library functions allocate memory.

A recent thread discussing stack-allocated, heap-allocated and statically-allocated arrays on the Pico may be found at

viewtopic.php?t=377389

Statistics: Posted by ejolson — Tue Oct 15, 2024 3:49 am



Viewing all articles
Browse latest Browse all 4906

Trending Articles