什么是 "allocation context"?
What is "allocation context"?
我是一名学生,我必须对内存泄漏检测进行研究。在许多论文中,他们都在谈论 分配上下文 。我不知道这是什么意思。我找不到 allocation context 的任何定义(或翻译,我来自德国)。
举个例子,引用一篇论文(Detecting Memory Leaks through Introspective Dynamic
使用机器学习的行为建模):
The key idea behind using machine learning is that a leaking object is discernible by observing the lifetimes of other similar objects. That is, an object can be regarded as having leaked when it accrues a high degree of staleness that is not observed from other supposedly similar objects, i.e., objects with the same allocation context.
或:
To work around this, this work takes inspiration from previous research on object lifetime prediction [4, 20]. According to these works, the lifetime of an object is strongly correlated with its allocation context. Since the staleness of an object is bounded by its lifetime, object staleness is transitively correlated with allocation context.
谁能尽可能简单地向我解释一下?
编辑:
摘要:
This paper expands staleness-based memory leak detection
by presenting a machine learning-based framework. The
proposed framework is based on an idea that object stal-
eness can be better leveraged in regard to similarity of ob-
jects; i.e., an object is more likely to have leaked if it shows
signicantly high staleness not observed from other similar
objects with the same allocation context.
A central part of the proposed framework is the modeling
of heap objects. To this end, the framework observes the
staleness of objects during a representative run of an ap-
plication. From the observed data, the framework generates
training examples, which also contain instances of hypothet-
ical leaks. Via machine learning, the proposed framework
replaces the error-prone user-denable staleness predicates
used in previous research with a model-based prediction.
The framework was tested using both synthetic and real-
world examples. Evaluation with synthetic leakage work-
loads of SPEC2006 benchmarks shows that the proposed
method achieves the optimal accuracy permitted by staleness-
based leak detection. Moreover, by incorporating
allocation context into the model, the proposed method achieves
higher accuracy than is possible with object staleness alone.
Evaluation with real-world memory leaks demonstrates that
the proposed method is eective for detecting previously re-
ported bugs with high accuracy.
我相信它只是意味着 "the context in which it was allocated"。
换句话说,您可以将其视为 "the observable state of the program that when the allocation occurred"——即调用堆栈、局部变量等
考虑这样的Cexample:
#include <stdlib.h>
void function_which_allocates(void) {
/* allocate an array of 45 floats */
float *a = malloc(sizeof(float) * 45);
/* additional code making use of 'a' */
/* return to main, having forgotten to free the memory we malloc'd */
}
int main(void) {
function_which_allocates();
/* the pointer 'a' no longer exists, and therefore cannot be freed,
but the memory is still allocated. a leak has occurred. */
}
a
的分配上下文是 function_which_allocates
。
因此,变量的分配上下文是该变量的 scope。
如果超出范围,则无法释放该内存,从而导致内存泄漏。
我收到了一位作者的回复。定义如下:
分配上下文
It refers to the call stack contents at the time of an allocation.
For example, if an allocation site is contained in function foo and the
function is called from main (during the execution), the allocation context
for the allocation site is (main, main: call@foo, foo: malloc(...)).
我是一名学生,我必须对内存泄漏检测进行研究。在许多论文中,他们都在谈论 分配上下文 。我不知道这是什么意思。我找不到 allocation context 的任何定义(或翻译,我来自德国)。
举个例子,引用一篇论文(Detecting Memory Leaks through Introspective Dynamic 使用机器学习的行为建模):
The key idea behind using machine learning is that a leaking object is discernible by observing the lifetimes of other similar objects. That is, an object can be regarded as having leaked when it accrues a high degree of staleness that is not observed from other supposedly similar objects, i.e., objects with the same allocation context.
或:
To work around this, this work takes inspiration from previous research on object lifetime prediction [4, 20]. According to these works, the lifetime of an object is strongly correlated with its allocation context. Since the staleness of an object is bounded by its lifetime, object staleness is transitively correlated with allocation context.
谁能尽可能简单地向我解释一下?
编辑:
摘要:
This paper expands staleness-based memory leak detection by presenting a machine learning-based framework. The proposed framework is based on an idea that object stal- eness can be better leveraged in regard to similarity of ob- jects; i.e., an object is more likely to have leaked if it shows signicantly high staleness not observed from other similar objects with the same allocation context. A central part of the proposed framework is the modeling of heap objects. To this end, the framework observes the staleness of objects during a representative run of an ap- plication. From the observed data, the framework generates training examples, which also contain instances of hypothet- ical leaks. Via machine learning, the proposed framework replaces the error-prone user-denable staleness predicates used in previous research with a model-based prediction. The framework was tested using both synthetic and real- world examples. Evaluation with synthetic leakage work- loads of SPEC2006 benchmarks shows that the proposed method achieves the optimal accuracy permitted by staleness- based leak detection. Moreover, by incorporating allocation context into the model, the proposed method achieves higher accuracy than is possible with object staleness alone. Evaluation with real-world memory leaks demonstrates that the proposed method is eective for detecting previously re- ported bugs with high accuracy.
我相信它只是意味着 "the context in which it was allocated"。
换句话说,您可以将其视为 "the observable state of the program that when the allocation occurred"——即调用堆栈、局部变量等
考虑这样的Cexample:
#include <stdlib.h>
void function_which_allocates(void) {
/* allocate an array of 45 floats */
float *a = malloc(sizeof(float) * 45);
/* additional code making use of 'a' */
/* return to main, having forgotten to free the memory we malloc'd */
}
int main(void) {
function_which_allocates();
/* the pointer 'a' no longer exists, and therefore cannot be freed,
but the memory is still allocated. a leak has occurred. */
}
a
的分配上下文是 function_which_allocates
。
因此,变量的分配上下文是该变量的 scope。
如果超出范围,则无法释放该内存,从而导致内存泄漏。
我收到了一位作者的回复。定义如下:
分配上下文
It refers to the call stack contents at the time of an allocation. For example, if an allocation site is contained in function foo and the function is called from main (during the execution), the allocation context for the allocation site is (main, main: call@foo, foo: malloc(...)).