Skip to content

Heap or Stack Allocated? #35

Answered by nkaaf
pixmusix asked this question in Q&A
May 30, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi, thanks for the feedback 😄

Memory Allocation

This library is using dynamic memory allocation with malloc and new, therefore the raw data of the lists are saved on the heap (internal references to the content on the stack). The list is saved on the stack or the heap, depending on your creation of the list (new -> heap; static creation (like examples) -> stack).

new/delete

The approach of using new is working in the context of an Arduino program (because of a custom override of new and delete) or standard C++ program (and probably more software architectures which I haven't testes). It is not working when avr-gcc is used (e.g. in Microchip Studio). Until I dealt with your question, I was…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by pixmusix
Comment options

You must be logged in to vote
2 replies
@nkaaf
Comment options

@pixmusix
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants