I use jemalloc 3.6.0-11.
I call posix_memalign to allocate a very large block. After allocating, I am calling madvise(ptr, size, MADV_DONTDUMP);
to exclude this allocation from the core dump.
Before freeing this memory, I call madvise(ptr, size, MADV_DODUMP);
because I want that if these pages will be allocated in a future allocation, they will not remain marked as DONTDUMP.
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.
Does anybody know how to solve this problem?
Thanks in advance!