| 1 |
<page xmlns="http://projectmallard.org/1.0/" |
| 2 |
xmlns:its="http://www.w3.org/2005/11/its" |
| 3 |
type="topic" |
| 4 |
id="faq"> |
| 5 |
|
| 6 |
<info> |
| 7 |
<link type="guide" xref="index#faq"/> |
| 8 |
</info> |
| 9 |
<title>What does heap mean?</title> |
| 10 |
|
| 11 |
<section id="what-does-heap-mean"> |
| 12 |
<title>What does "In file [heap]" mean?</title> |
| 13 |
|
| 14 |
<p>This means that sysprof believes a function was called from somewhere in |
| 15 |
the program's heap (where <code>malloc</code> allocates memory) rather than |
| 16 |
the code section (where executable code normally lives.) There are several |
| 17 |
possible explanations. |
| 18 |
</p> |
| 19 |
</section> |
| 20 |
|
| 21 |
<section id="jit"> |
| 22 |
<title>JIT (Just in Time) compilers</title> |
| 23 |
|
| 24 |
<p>Languages like Java can generate executable code while a program is |
| 25 |
running and store it in the heap. Sysprof is accurately reporting the |
| 26 |
situation in this case.</p> |
| 27 |
</section> |
| 28 |
|
| 29 |
<section id="optimizing"> |
| 30 |
<title>Optimizing compilers</title> |
| 31 |
|
| 32 |
<p>C and C++ compilers can optimize away information needed to determine a |
| 33 |
function's caller, so it is mistaken for [heap]. You can still tell how |
| 34 |
often each function is called by the program, but not always from |
| 35 |
where.</p> |
| 36 |
|
| 37 |
<note> |
| 38 |
<p>For gcc, the flag <code>-fno-omit-frame-pointer</code> will prevent |
| 39 |
this optimization. The flag is not always needed, for example on x86_64 |
| 40 |
machines it is only needed with -O3 optimization.</p> |
| 41 |
</note> |
| 42 |
|
| 43 |
<note> |
| 44 |
<p>To get the most detailed and accurate call tree from un-optimized |
| 45 |
code, use these flags: <code>-ggdb -fno-omit-frame-pointer -O0</code></p> |
| 46 |
</note> |
| 47 |
</section> |
| 48 |
</page> |