Introduction
Memory management has undergone several changes, but it has not yet matured. These changes mainly include:
1. From Malloc/free to New/delete. This change is the product of the rise of OOP technology. C + + is a strongly typed language, and the main result of New/delete is that it reinforces the concept of type and reduces the need for forced type conversions. But from a memory management perspective, this change is not much of a breakthrough.
2. From New/delete to Memory Configurator (allocator). Since the STL has been incorporated into the C + + standard library, the C + + world has changed dramatically. From the point of view of memory management, the introduction of allocator is also a breakthrough in C + + memory management. Notice that you can see that the entire STL memory is allocated from allocator to all components. That is, the STL does not recommend the use of New/delete for memory management, but recommend the use of allocator.
However, the allocator of STL does not cause the C + + language to change greatly in memory management. In addition to the STL itself, not many people use allocator, or even realize the importance of allocator. Therefore, C + + programmers in the use of STL, while still using new/delete for cumbersome memory allocation/release process.
The main reasons are two. First, the introduction of allocator, STL designers may be based on the memory management from the implementation of the container independent of the design concept of the role, so that STL users in the memory management algorithm has a choice. The designers themselves may not be aware of the importance of allocator. The second is that the allocator itself is focused on efficiency rather than on the change of memory management concepts by C + + language users.
In short, in my opinion, the introduction of STL allocator, is a great thing. But the change has been neglected and not implemented. Of course, this is also related to the defects of the STL allocator itself.
In this paper, it is how to carry out the allocator thought of STL, and make appropriate improvement to it, in order to produce a transformative breakthrough in the concept of C + + memory management, and eliminate the traditional New/delete memory management method completely.