How do games like GTA IV not fragment the heap?

后端 未结 6 1252
深忆病人
深忆病人 2021-01-31 05:21

I\'m interested in the type of memory management a game like GTA IV might use given that it needs to create and delete lots of objects very quickly. How do the avoid fragmenting

6条回答
  •  长情又很酷
    2021-01-31 05:53

    There are two very good malloc implementations for multi-threaded implementations:

    • tcmalloc: by Google
    • jemalloc: used by Apache (for example)

    Here is Facebook's article about improving jemalloc. It's about 5 times faster that Hoard's memory allocator in the current top answer :)

提交回复
热议问题