Custom memory allocator/manager in C ? which approach?

前端 未结 2 2017
梦谈多话
梦谈多话 2021-01-31 05:40

I looking for some (custom) memory managers/allocator written in c and went through some articles, -

Some Links :

  • IBM - Inside memory management
  • V
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 06:24

    Fragmentation from heterogeneous allocation/de-allocation sizes or sequences should be handled, I can write the schema / wrapper to provide the same.

    To avoid fragmentation, you will have to use a hybrid block allocation strategy. Hybrid here means different sized element blocks than having single sized element blocks i.e. The allocator (or a wrapper around it) should maintain blocks of different-sized elements(small, medium and large etc.). All allocation requests should be rounded up to the nearest block boundary. This strategy shall ensure you will not suffer from external fragmentation but can cause internal fragmentation. You can find more info at the following links:

    http://www.cotsjournalonline.com/magazine/articles/view/101217/pg:2 http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf

提交回复
热议问题