Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
libpcp_pmda: Fixed a memory leak detected by valgrind. #21
Conversation
|
Ken reviewed this, added automated testing, and merged it - closing. |
natoscott
closed this
May 25, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
marcliangma7 commentedMay 15, 2015
Original issue created at: #19
pmdaproc has memory leaks using the following python monitor client to collect process list at 1 second interval.
/proc/pmdaproc_pid/smaps: (Heap size hits 18Mb after 5 days run)
02416000-035a1000 rw-p 00000000 00:00 0 [heap]
Size: 17964 kB
Rss: 17852 kB
Pss: 17852 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 0 kB
Private_Dirty: 17852 kB
Referenced: 17852 kB
Anonymous: 17852 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac
Valgrind output:
/home/ec2-user/pcp/src/libpcp/src0x42
1
Leak_DefinitelyLost
615,463 bytes in 25,293 blocks are definitely lost in loss record 65 of 65
615463
25293
0x4C2741D
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so
malloc
0x505C48D
/usr/local/lib/libpcp.so.3
__pmDecodeNameList
p_pmns.c
344
0x4E38277
/usr/lib64/libpcp_pmda.so.3
__pmdaMainPDU
/home/ec2-user/pcp/src/libpcp_pmda/src
mainloop.c
201
0x4E386D7
/usr/lib64/libpcp_pmda.so.3
pmdaMain
/home/ec2-user/pcp/src/libpcp_pmda/src
mainloop.c
428
0x402CA6
/var/lib/pcp/pmdas/proc/pmdaproc
main
/home/ec2-user/pcp/src/pmdas/linux_proc
pmda.c
3153
Python client used to repro the issue:
!/usr/bin/python
from cpmapi import PM_TYPE_U32, PM_TYPE_FLOAT, PM_TYPE_STRING, PM_TYPE_U64
from pcp import pmapi
import json
import sys
import time
class Prototype(object):
if name == 'main':
testApp = Prototype()
testApp.connect()
while True:
testApp.execute()
time.sleep(1)