Possible bcc memory leak
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 3
Description
Testing with `cat ./test.py ; python3 ./test.py & pid=$! ; sleep 1 ; grep VmRSS /proc/$pid/status ; sleep 60 ; grep VmRSS /proc/$pid/status ; kill $pid ;` we see this output:
```
import gc
from bcc import BPF
while True:
bpf = BPF(text="BPF_ARRAY(t);")
bpf.cleanup()
gc.collect()
VmRSS: 91828 kB
VmRSS: 93388 kB
```
1) It seems that there is some minor memory leak during bpf.cleanup(), this is irrelevant for simple scripts but for long-running daemons that dynamically attach/detach BPF programs this is more relevant.
2) Overall memory consumption is perhaps a bit high, for example on my laptop only gnome-shell and firefox are currently using more memory (RSS) than the most simple BCC example (`pidpersec`), processes like X, totem (playing audio), NetworkManager, etc are using less memory.
Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the test.py loop using BPF(text="BPF_ARRAY(t);") and bpf.cleanup(), then reproduce the VmRSS measurements before and after the 60-second interval. Trace the cleanup path and compare it with the pidpersec example; done means identifying the source of the growth and adding a regression check for repeated attach/detach cycles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- observability, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100