Commit ff50550
committed
context/data: memleak due to API (mis)use
Memory management is a foreign concept to python in general, howevrer it
appears DNode and Context require .free() and .destroy() to be called,
respectively, to avoid a memory leak.
This seems easily avoidable by simply attaching a destructor to the
class so the python garbage collector can clean up automatically when all
references go out of scope.
This change should also be compatible with existing integrations which may be
aware of this as it sets the internal `cdata` reference to None and checks
it to ensure it doesn't run the cleanup again.
Signed-off-by: Brad House <[email protected]>1 parent 8534053 commit ff50550
2 files changed
+15
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
| |||
996 | 999 | | |
997 | 1000 | | |
998 | 1001 | | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
1006 | 1010 | | |
1007 | 1011 | | |
1008 | 1012 | | |
| |||
0 commit comments