What's the difference between a memory arena and a memory allocator?

…衆ロ難τιáo~ 提交于 2020-01-13 03:02:27

问题


This is more a semantic question than a coding question....

What's the difference between a memory arena and a memory allocator?

I'm working in C++ and I'm seeing some memory management libs using concepts like "memory arena", "memory allocator" and sometimes both in the same lib.

I know what an allocator is; I'm just not sure what a memory arena is if it's not just another word for allocator.


回答1:


"Memory arena" typically means a large lump (or collection of lumps) of memory from which smaller lumps are allocated. The word "pool" is also commonly used for such a thing.

"Memory allocator" typically means the software that determines how to allocate memory from an arena.




回答2:


Strictly speaking, a "memory arena" is a pool of memory that a "memory allocator" allocates memory from. But I wouldn't be surprised to see "memory arena" used as a synonym for "memory allocator".



来源:https://stackoverflow.com/questions/13381123/whats-the-difference-between-a-memory-arena-and-a-memory-allocator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!