[#6502] sysv shared mem (shm) funcs have a small mem leak
Submitted By: Mike Frysinger
Open Fixed In Release:
Found In Release:
ALL Silicon Revision:
Is this bug repeatable?:
Uboot version or rev.:
Toolchain version or rev.:
App binary format:
Summary: sysv shared mem (shm) funcs have a small mem leak
as reported in the forums:
there seems to be a small mem leak inside the kernel when creating/deleting sysv shared segments. simple test case is to call shmget() followed by shmctl(IPC_RMID) and obverse the free memory slowly being lost.
/proc/meminfo flags this all under "Inactive(file)" ...
$ bfin-uclinux-gcc test.c
$ rcp a.out root@bfin:/
root:/> cp /proc/meminfo /
root:/> /a.out && /a.out && /a.out && /a.out && /a.out && /a.out && ...
root:/> diff -u meminfo /proc/meminfo
-Inactive(file): 7040 kB
+Inactive(file): 38212 kB
--- Bob Liu 2011-03-18 03:29:22
It seems a kernel bug.
n my opinion, on no-mmu arch iput() will call generate_delete_inode()
> truncate_page_range() which just delete the page from pagecache.
But pages allocated by ramfs_nommu_expand_for_mapping() have
page->_count = 2 (one by alloc_pages + one by pagecache).
The page->_count is still 1 after iput(), so the memory can't be freed.
--- Bob Liu 2011-04-15 01:36:45
fixed by commit 9834
File Name File Type File Size Posted By
test.c text/x-csrc 449 Mike Frysinger