apparent memory leak using posix_memalign
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
when allocating and deallocating memory of sufficient size with posix_memalign while keeping smaller allocations done with malloc, a memory leak happens. This only appears when using certain ranges of allocation sizes, and can cause the system to lock up when running out of memory while only having a few megabytes allocated on a 16GB ram machine.
lsb_release -rd:
Description: Ubuntu 18.04.3 LTS
Release: 18.04
apt-cache policy libc6:
libc6:
Installed: 2.27-3ubuntu1
Candidate: 2.27-3ubuntu1
Version table:
*** 2.27-3ubuntu1 500
500 http://
100 /var/lib/
see attached for a small program that will trigger the memory leak
I have not tried this on other distros, so don't know if this is ubuntu specific
Forgot to add:
I compiled with gcc 7.4:
gcc (Ubuntu 7.4.0-1ubuntu1~ 18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
using the following command line:
$ gcc -O0 -g -o memleak memleak.c