title: Mtrace Physical Memory Allocation Log
body: <p>I wanted to ask if I could use the mtrace() function in order for my program to log the physical addresses of the memory allocations. Also, if I use mtrace() and is able to show the addresses used for allocation, will this show me the addresses in the physical or virtual memory?</p>
  
  <p>Thank you in advance.</p>
  
  <p>Edit:
  Ok, so I run the following code:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;mcheck.h&gt;
  
  int main(void) { 
  
  mtrace(); /* Starts the recording of memory allocations and releases */
  
  int* a = NULL;
  
  a = malloc(sizeof(int)); /* allocate memory and assign it to the pointer */
  if (a == NULL) {
      return 1; /* error */
  }
  
  free(a); /* we free the memory we allocated so we don't have leaks */
  muntrace();
  
  return 0; /* exit */
  
  }
  </code></pre>
  
  <p>It gives me the following output:</p>
  
  <pre><code>=Start
  @ ./a.out:[0x80484a6] + 0x9738378 0x4
  @ ./a.out:[0x80484c4] + 0x9738378
  = End
  </code></pre>
  
  <p>Are the addresses shown in virtual memory or in physical memory?</p>