title: Core dump size is increased after freeing memory that was excluded from the core
body: <p>I use jemalloc 3.6.0-11.
  I call posix_memalign to allocate a very large block. After allocating, I am calling <code>madvise(ptr, size, MADV_DONTDUMP);</code> to exclude this allocation from the core dump.</p>
  <p>Before freeing this memory, I call <code>madvise(ptr, size, MADV_DODUMP);</code> because I want that if these pages will be allocated in a future allocation, they will not remain marked as DONTDUMP.</p>
  <p>The problem is that in most of the cases, the memory that I have just freed is not returned to the OS (that is, the virtual memory of the process still includes the allocation; in /proc//status the allocation size is still a part of VmSize); and it turns out that the core dump is based on the process's virtual memory; so after freeing the memory, the freed pages will be included in the core dump.</p>
  <p>Does anybody know how to solve this problem?</p>
  <p>Thanks in advance!</p>