python BPF class destructor
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
Hello,
I am trying to add bpf_obj_pin support and want to remove the pinned bpf table when python BPF class is destroyed. I have written the bpf_obj_pin deletion code in BPFModule destructor. However, currently it isn't called at python BPF class destruction.
cc/bpf_module.h have a destructor (BPFModule::~BPFModule()), which is only called in case the BPF code fails to compile. Shouldn't python BPF class need to have a destructor (**del** or **exit**) which should call the cc/bpf_module.h destructor at exit?
diff --git a/src/python/bcc/**init**.py b/src/python/bcc/**init**.py
index 8c1ef59..8e45154 100644
--- a/src/python/bcc/**init**.py
+++ b/src/python/bcc/**init**.py
@@ -1064,3 +1064,6 @@ class BPF(object):
except KeyboardInterrupt:
exit()
- def **del**(self):
- if(self.module):
- return lib.bpf_module_destroy(self.module)
or are there some cases where python BPF code exit but we don't want to destroy BPFModule?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.