Timeline for int array passed through function has wrong values only after multiple passes
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 28, 2021 at 18:14 | vote | accept | Saha | ||
| Mar 28, 2021 at 16:48 | answer | added | chrisl | timeline score: 0 | |
| Mar 28, 2021 at 16:05 | review | Close votes | |||
| Apr 14, 2021 at 4:55 | |||||
| Mar 28, 2021 at 16:05 | comment | added | Saha | @chrisl Do I have to free them up manually? I thought the arrays would free up if the function ends? | |
| Mar 28, 2021 at 15:59 | comment | added | Saha | @chrisl I added the full code although I don't know if it's of any use to you. | |
| Mar 28, 2021 at 15:56 | history | edited | Saha | CC BY-SA 4.0 |
added 2431 characters in body
|
| Mar 28, 2021 at 15:48 | comment | added | timemage | The part that's actually a problem is really a general programming problem. | |
| Mar 28, 2021 at 15:46 | comment | added | chrisl |
Mhh, I see you creating 3 new arrays on each call of multiLamp(), but I never see you freeing them again. Beside the fact, that dynamic memory allocation is bad on an AVR board like the Uno, you need to actually free the allocated memory again, when you don't need it anymore, or you will rather fast fill up the RAM. If no memory is left, the Arduino behavior is undefined (though mostly they just reset). That seems the best candidate for the problem reason. Can you please provide a full compilable example sketch, which shows your problem? (not just a snippet)
|
|
| Mar 28, 2021 at 15:43 | review | First posts | |||
| Mar 28, 2021 at 17:11 | |||||
| Mar 28, 2021 at 15:38 | history | asked | Saha | CC BY-SA 4.0 |