Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为学习嵌入式软件的初学者,我无法理解保留内存和分配内存之间的细微差别,有人可以帮助我吗?
在您引用的段落中,他们只是在谈论调用堆栈(这是可能的内存类型之一)。
调用堆栈具有在编译时“保留”的最大大小,但在程序启动时它大部分未使用。当您进行函数调用时,您的局部变量和函数调用会被压入堆栈 - 临时“分配”内存直到函数返回 - 然后它被“释放”。
如果你分配的内存比你保留的多——例如无限递归,那么你的程序将有一个......
堆栈溢出错误。