什么是相对于内存中的术语“江湖”的含义? [英] What is the meaning of the term 'arena' in relation to memory?

查看:120
本文介绍了什么是相对于内存中的术语“江湖”的含义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读记忆文本作为编程的概念。在后面的章节之一,作者大量使用单词'舞台',但从来没有定义它。我搜索这个词的技术含义,但一无所获。下面是在笔者使用的术语是'竞技场'几个背景:

I'm reading a text 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 searched for a technical meaning of the word but found nothing. Here are a few contexts in which the author uses the term 'arena':

序列化的下一个例子包括一个叫做策略
  内存分配从特定的舞台。

"The next example of serialization incorporates a strategy called memory allocation from a specific arena."

...内存泄漏处理或分配时,当这是非常有用的
  从特定的舞台。

"...this is useful when dealing with memory leaks or when allocating from a specific arena."

......如果我们要释放内存,然后我们会在释放
  整个球馆。

"...if we want to deallocate the memory then we will deallocate the whole arena."

笔者使用这一章中的术语超过100次。在词汇表中的唯一相关的定义是:

The author uses the term over 100 times in this one chapter. The only related definition in the glossary is:

从舞台配置 - 先分配一个舞台技术
  由程序管理舞台上的分配/释放
  本身(而不是由程序内存管理器);用于
  压实和复杂的数据结构和对象的序列化,
  或在安全关键和/或容错内存管理
  系统。

allocation from arena - Technique of allocating an arena first and then managing the allocation/deallocation within the arena by the program itself (rather then by the process memory manager); used for compaction and serialization of complex data structures and objects, or for managing memory in safety-critical and /or fault-tolerant systems.

唯一相关的问题我已经在SO发现是内存竞技场2 异常安全一>,并没有帮助。任何人都可以定义'舞台',我给了这些背景?

The only related question I've found on SO is Exception safety in memory arena 2, and was no help. Can anyone define 'arena' for me given these contexts?

推荐答案

这是江湖只是一个大的,连续的一块,你分配一次,然后用它来通过分发内存的部分手动管理内存的内存。例如:

An arena is just a large, contiguous piece of memory that you allocate once and then use to manage memory manually by handing out parts of that memory. For example:

char * arena = malloc(HUGE_NUMBER);

unsigned int current = 0;

void * my_malloc(size_t n) { current += n; return arena + current - n; }

问题的关键是,你得到了怎样的内存分配工作完全控制。你的控制范围之外的唯一一件事是单库调用初始分配。

The point is that you get full control over how the memory allocation works. The only thing outside your control is the single library call for the initial allocation.

一种流行的使用情况是,其中每个竞技场仅用于分配一个单一,固定大小的存储器块。在这种情况下,你可以写非常有效的回收算法。另一个用例是让每个任务一舞台,当你与任务完成后,你可以在一个去自由整个舞台,不需要担心跟踪单个释放操作。

One popular use case is where each arena is only used to allocate memory blocks of one single, fixed size. In that case, you can write very efficient reclamation algorithms. Another use case is to have one arena per "task", and when you're done with the task, you can free the entire arena in one go and don't need to worry about tracking individual deallocations.

每个这些技术是非常专业的,一般只就派上用场了,如果你知道你在做什么,为什么正常的库分配是不够的。需要注意的是一个良好的内存分配都已经做很多神奇的本身,你需要的证据像样的数目,你开始自己处理内存之前,这还不够好。

Each of those techniques is very specialized and generally only comes in handy if you know exactly what you're doing and why the normal library allocation is not good enough. Note that a good memory allocator will already do lots of magic itself, and you need a decent amount of evidence that that's not good enough before you start handling memory yourself.

这篇关于什么是相对于内存中的术语“江湖”的含义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆