Summary
This chapter dove deep into the murky waters of memory managers. We started on the light side with a discussion of strings, arrays, and how memory for them is managed.
After that, I enumerated all memory management functions exposed by Delphi. We saw how we can allocate memory blocks, change their size, and free them again. We also learned about memory management functions designed to allocate and release managed data—strings, interfaces, dynamic arrays, and so on.
The next part of the chapter was dedicated to records. We saw how to allocate them, how to initialize them, and even how to make dynamically allocated records function together with generic types. We also saw that records are not just faster to create than objects but also use less memory.
Then, we went really deep into the complicated world of memory manager implementation. I explained—from a very distant viewpoint—how FastMM4 is organized internally and what tricks it uses to speed...