关于c++:C内存管理7VC6BC5G29-的标准分配器实现

2次阅读

共计 584 个字符,预计需要花费 2 分钟才能阅读完成。

VC6 下的 malloc 内存块布局

对应图中自上而下的内存耗费:

malloc(0x0c) ==>

4 + (4 * 8) + 0x0C + 4 + (2 * 4) + 4 = 0x40

VC6 规范分配器的实现

VC6 的 allocator 只是以 ::operator new 和 ::operator delete 实现 allocate() 和 deallocate(), 没有任何非凡设计

VC6 所附的规范库,其 std::allocator 实现如下 (<xmemory>)

BC5 规范分配器的实现

BC5 的 allocator 只是以 ::operator new 和 ::operator delete 实现 allocate() 和 deallocate(), 没有任何非凡设计

BC5 所附的规范库,其 std::allocator 实现如下 (memory.stl)

G2.9 规范分配器的实现

G2.9 的 allocator 只是以 ::operator new 和 ::operator delete 实现 allocate() 和 deallocate(), 没有任何非凡设计

G2.9 所附的规范库,其 std::allocator 实现如下 (<defalloc.h>)

(不要应用这个文件,除非您有一个旧的容器实现,须要一个带有 hp 格调接口的分配器。SGI STL 应用不同的分配器接口。sgi 格调的分配器没有对象类型的参数化,它们在 void* 指针中传输。这个文件不包含在其余 SGI STL 头文件中)

正文完
 0