[#6502] sysv shared mem (shm) funcs have a small mem leak
Submitted By: Mike Frysinger
Open Date
2011-03-03 01:58:11
Priority:
Medium Assignee:
Bob Liu
Status:
Open Fixed In Release:
N/A
Found In Release:
snaps Release:
Category:
N/A Board:
N/A
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
trunk
App binary format:
N/A
Summary: sysv shared mem (shm) funcs have a small mem leak
Details:
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
...
Follow-ups
--- 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
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
test.c text/x-csrc 449 Mike Frysinger