Commit b6c7ec4
committed
fix memory leaks in generated bindings
This addresses a couple of issues:
- We weren't freeing canonical ABI results after calling imports and then
converting the results to Python values.
- We were using the PyO3 `Bound` APIs incorrectly in a few places, resulting in
refcounts being incremented too many times.
While debugging the latter issue, I took the opportunity to update to the latest
PyO3 release, which required addressing the usual API breakage. It also
required temporarily forking the repo to add a patch to disable `extern
"C-unwind"` in `pyo3_ffi` on `wasm32`. We should be able to drop that fork once
we upgrade everything to Python 3.14.
Finally, I discovered
https://pyo3.rs/v0.25.0/features.html#pyo3_disable_reference_pool which
supposedly optimizes Rust<->Python transitions by disabling a feature we don't
rely on anyway, so I went ahead and enabled it.
Fixes #152
Signed-off-by: Joel Dice <joel.dice@fermyon.com>1 parent a63e030 commit b6c7ec4
9 files changed
Lines changed: 190 additions & 143 deletions
File tree
- runtime
- src
- src
- test
- python_source
- wit
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
0 commit comments