What is the meaning of the term arena in relation to memory?

前端 未结 4 1347
感情败类
感情败类 2021-01-29 19:02

I\'m reading a book on memory as a programming concept. In one of the later chapters, the author makes heavy use of the word arena, but never defines it. I\'ve

4条回答
  •  不要未来只要你来
    2021-01-29 19:53

    Think of it as a synonym for 'heap'. Ordinarily, your process only has one heap/arena, and all memory allocation happens from there.

    But, sometimes you have a situation where you would to group a series of allocations together (e.g. for performance, to avoid fragmentation, etc.). In that case, it's better to allocate a new heap/arena, and then for any allocation, you can decide which heap to allocate from.

    For example, you might have a particle system where lots of objects of the same size are being frequently allocated and deallocated. To avoid fragmenting memory, you could allocate each particle from a heap which is only used for those particles, and all other allocations would come from the default heap.

提交回复
热议问题