Efficiently allocating many short-lived small objects

前端 未结 3 881
有刺的猬
有刺的猬 2021-02-08 11:27

I\'ve got a small class (16 bytes on a 32bit system) which I need to dynamically allocate. In most cases the life-time of any given instance is very short. Some instances may al

3条回答
  •  不知归路
    2021-02-08 12:00

    Maybe try using Google's tcmalloc? It is optimized for fast allocation/deallocation in a threaded program, and has low overhead for small objects.

提交回复
热议问题