File tree Expand file tree Collapse file tree
crates/c-api/include/wasmtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ public:
233233
234234 // / Runs a garbage collection pass in the referenced store to collect loose
235235 // / GC-managed objects, if any are available.
236- void gc () { context ().gc (); }
236+ Result<std::monostate> gc () { return context ().gc (); }
237237
238238private:
239239 template <typename F>
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ int main() {
9595 }
9696
9797 std::cout << " GCing within the store...\n " ;
98- store.context ().gc ();
98+ if (!store.context ().gc ()) {
99+ std::cerr << " > Error while collecting garbage\n " ;
100+ return 1 ;
101+ }
99102
100103 std::cout << " Done.\n " ;
101104 return 0 ;
Original file line number Diff line number Diff line change @@ -50,5 +50,10 @@ int main() {
5050 << " \n " ;
5151
5252 std::cout << " Running a gc..\n " ;
53- store.context ().gc ();
53+ if (!store.context ().gc ()) {
54+ std::cerr << " > Error while collecting garbage\n " ;
55+ return 1 ;
56+ }
57+
58+ return 0 ;
5459}
You can’t perform that action at this time.
0 commit comments