Summary
As part of this chapter, we mainly covered the Stack and Heap segments and the way they should be used. After that, we briefly discussed memory-constrained environments and we saw how techniques like caching and memory pools can increase the performance.
In this chapter:
- We discussed the tools and techniques used for probing both Stack and Heap segments.
- We introduced debuggers and we used
gdb
as our main debugger to troubleshoot memory-related issues. - We discussed memory profilers and we used
valgrind
to find memory issues such as leakages or dangling pointers happening at runtime. - We compared the lifetime of a Stack variable and a Heap block and we explained how we should judge the lifetime of such memory blocks.
- We saw that memory management is automatic regarding Stack variables, but it is fully manual with Heap blocks.
- We went through the common mistakes that happen when dealing with Stack variables.
- We discussed the constrained environments...