Get the latest tech news
Writing a simple pool allocator in C
Table of Contents - 1. Introduction - 2.
In a more general implementation, we would use a chunk size specified by the programmer at runtime, but that method adds a lot of casts, and I think it would make this article more confusing. Now that we have a way of storing the start addresses of an indefinite number of chunk arrays, we can implement the resizing method shown in the previous figure. Just like in the previous figure, the green and blue regions represent arrays allocated independently, but their respective LinkedPtr structures are also included in the diagram.
Or read this on Hacker News