Hello all,
I don't fully understand how some of this memory stuff with C works on the calculator (TI84+ CE). I found this https://www.cemetech.net/forum/viewtopic.php?t=19920 topic but it doesn't go into too much detail about why. This is my current understanding as well as some questions I have.
• Calling malloc() is discouraged because it is slow. I should statically allocate instead.
○ Is speed the only reason against using malloc()?
○ Is the call to malloc() the slow part or is it slower to access heap memory?
○ Will the toolchain or OS free() my memory or do I need to do that myself at the end of the program? What about functions like gfx_MallocSprite(), do I free that memory too?
○ There's nothing special about statically allocating, right? You just
Code:
Should these forum members decide to grace me with their wisdom, I would be very grateful. 😁
I don't fully understand how some of this memory stuff with C works on the calculator (TI84+ CE). I found this https://www.cemetech.net/forum/viewtopic.php?t=19920 topic but it doesn't go into too much detail about why. This is my current understanding as well as some questions I have.
• Calling malloc() is discouraged because it is slow. I should statically allocate instead.
○ Is speed the only reason against using malloc()?
○ Is the call to malloc() the slow part or is it slower to access heap memory?
○ Will the toolchain or OS free() my memory or do I need to do that myself at the end of the program? What about functions like gfx_MallocSprite(), do I free that memory too?
Quote:
Just statically allocate.
○ There's nothing special about statically allocating, right? You just
Code:
int my_var[100];Should these forum members decide to grace me with their wisdom, I would be very grateful. 😁

