Summary

This chapter focused upon both the simple and more advanced aspects of dynamic memory management for C application developers on the Linux OS. In the initial section, the basic glibc dynamic memory-management APIs and their correct usage in code was dealt with.

We then moved on to more advanced topics such as the program break (and the sbrk(3) API), how malloc(3) behaves internally when allocating memory of differing sizes, and the key concept of demand-paging. Then, we delved into the APIs that perform memory locking and memory region protection, and reasons to use them. Finally, we looked at alloca(3), the alternate API. Several code examples were used to solidify the concepts that were learned. The next chapter will cover a really ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.