title: Understanding memory maps
body: <p>I'm very new to C programming and investigating continuously increasing RSS size. The suspicion is there is some memory leak. I looked at the <code>/proc/&lt;pid&gt;/maps</code> and found the following:</p>
  
  <pre><code>f8000000-fb180000 rw-p 00000000 00:00 0
  fb180000-fd580000 ---p 00000000 00:00 0
  fd580000-fdc80000 rw-p 00000000 00:00 0
  fdc80000-100000000 ---p 00000000 00:00 0
  100000000-1005a0000 rw-p 00000000 00:00 0
  1005a0000-140000000 ---p 00000000 00:00 0
  7fb45d1dd000-7fb45d1e0000 ---p 00000000 00:00 0
  7fb45e0ec000-7fb45e0ef000 ---p 00000000 00:00 0
  7fb45e0ef000-7fb45e1ed000 rw-p 00000000 00:00 0
  7fb45e1ed000-7fb45e1f0000 ---p 00000000 00:00 0
  7fb45e1f0000-7fb45e2ee000 rw-p 00000000 00:00 0
  7fb45e2ee000-7fb45e2f1000 ---p 00000000 00:00 0
  7fb45e2f1000-7fb45e3ef000 rw-p 00000000 00:00 0
  7fb45e3ef000-7fb45e3f2000 ---p 00000000 00:00 0
  7fb45e3f2000-7fb45e4f0000 rw-p 00000000 00:00 0
  7fb45e4f0000-7fb45e4f3000 ---p 00000000 00:00 0
  7fb45e4f3000-7fb45e5f1000 rw-p 00000000 00:00 0
  7fb45e5f1000-7fb45e5f4000 ---p 00000000 00:00 0
  7fb45e5f4000-7fb45e6f2000 rw-p 00000000 00:00 0
  7fb45e6f2000-7fb45e6f5000 ---p 00000000 00:00 0
  7fb45e6f5000-7fb45e7f3000 rw-p 00000000 00:00 0
  7fb45e7f3000-7fb45e7f6000 ---p 00000000 00:00 0
  7fb45e7f6000-7fb45e8f4000 rw-p 00000000 00:00 0
  7fb45e8f4000-7fb45e8f7000 ---p 00000000 00:00 0
  //Tons of the similar entries...
  7fb71652b000-7fb71652c000 rw-p 0001a000 08:01 2187                       /lib/x86_64-linux-gnu/libpthread-2.27.so
  7fb716568000-7fb71656f000 r--s 00000000 08:01 5020                       /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
  7fb716759000-7fb71675a000 rw-p 00000000 00:00 0
  7ffc5f781000-7ffc5f7a2000 rw-p 00000000 00:00 0                          [stack]
  7ffc5f7c7000-7ffc5f7ca000 r--p 00000000 00:00 0                          [vvar]
  7ffc5f7ca000-7ffc5f7cc000 r-xp 00000000 00:00 0                          [vdso]
  ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
  </code></pre>
  
  <p>The thing that I noticed was that the vast majority of <code>/proc/&lt;pid&gt;/maps</code> were  entries like:</p>
  
  <pre><code>7fb45e7f3000-7fb45e7f6000 ---p 00000000 00:00 0
  </code></pre>
  
  <p>What does this mean? Doesn't it mean that system allocator release the memory it acquires?</p>
  
  <p>Is there a way to examine the memory content at address, e.g.  <code>7fb45e5f4000-7fb45e6f2000</code> at run-time?</p>
  
  <p>I tried to attach to the running process with gdb and looked at the memory.</p>
  
  <pre><code>(gdb) x /1xg 0x7fb45e1ed000
  0x5e1ed000:     Cannot access memory at address 0x5e1ed000
  </code></pre>