This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Commit 0f958c9
committed
fix memory leak when panicking with detached
In `ComponentInstance::from_vmctx` and
`StoreContextMut::with_detached_instance[_async]` we were leaking memory due to
having taken `InstanceData` out of the `Store` and making it unreachable except
via a raw pointer, meaning there was nothing responsible for dropping it on
panic. This commit adds an RAII wrapper to take care of that.
Signed-off-by: Joel Dice <joel.dice@fermyon.com>ComponentInstance
1 parent 90e7e16 commit 0f958c9
2 files changed
Lines changed: 37 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
688 | 696 | | |
689 | 697 | | |
690 | 698 | | |
| |||
721 | 729 | | |
722 | 730 | | |
723 | 731 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
729 | 738 | | |
730 | 739 | | |
731 | 740 | | |
| |||
753 | 762 | | |
754 | 763 | | |
755 | 764 | | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
760 | 770 | | |
761 | 771 | | |
762 | 772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
194 | 202 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
199 | 207 | | |
200 | | - | |
| 208 | + | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| |||
0 commit comments