C++: Memory allocators

前端 未结 5 1110
情话喂你
情话喂你 2020-12-25 15:51

I\'ve heard about people using custom memory allocators for their project, particulary in C++.

  • What is a custom memory allocator, compared to malloc?

5条回答
  •  隐瞒了意图╮
    2020-12-25 15:59

    Memory allocators are used as optimizations for speed. Allocations by the Operating system are slow. So your own memory manager grabs a large bucket of memory, and then makes the allocations for you from that memory bucket without going through the OS. This technique is more frequently used in games/consoles/embeded systems.

    http://www.memorymanagement.org/articles/

    http://www.ibm.com/developerworks/aix/tutorials/au-memorymanager/au-memorymanager-pdf.pdf

提交回复
热议问题