My program always crash when using large arrays(100*1024),serial Prompt information:
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
Register dump:
PC : 00000000 PS : 00000000 A0 : 00000000 A1 : 8007838d
A2 : 3ffe3c60 A3 : 50000008 A4 : 3ff0005c A5 : 00000000
A6 : 00000009 A7 : 00020010 A8 : 80078506 A9 : 00030000
A10 : 3ffe5650 A11 : 3ffe5650 A12 : 00000000 A13 : 80078506
A14 : 3ffe3ca0 A15 : 40080a2c SAR : 000008e
What's the problem?
Crashing when using large arrays
Re: Crashing when using large arrays
Hi star_7,
Please post new topics when asking a new question, rather than replying to unrelated topic. I've split your post into a new topic.
If your array is allocated on the stack, you will need to make sure your task has a large enough stack. The third parameter to xTaskCreate() specifies the stack size.
If your array is allocated in heap with malloc(), you should test for a NULL result. For some large arrays, malloc() may fail if there is not enough contiguous memory available. It sounds like you are allocating on the stack, though.
Angus
Please post new topics when asking a new question, rather than replying to unrelated topic. I've split your post into a new topic.
If your array is allocated on the stack, you will need to make sure your task has a large enough stack. The third parameter to xTaskCreate() specifies the stack size.
If your array is allocated in heap with malloc(), you should test for a NULL result. For some large arrays, malloc() may fail if there is not enough contiguous memory available. It sounds like you are allocating on the stack, though.
Angus
Re: Crashing when using large arrays
To add a little to what Angus said ... I like to also use the esp_get_free_heap() function which returns the current amount of free heap storage. You can't dynamically allocate more free space than what is available as returned by that function.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Who is online
Users browsing this forum: No registered users and 86 guests