We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3b4e7f commit 9b1a54dCopy full SHA for 9b1a54d
1 file changed
src/runtime/gc.c
@@ -251,6 +251,19 @@ static void freeObject(Obj* object) {
251
FREE(struct ObjDictionary, object);
252
break;
253
}
254
+ case OBJ_TASK: {
255
+ // coroHandle is void* managed by LLVM/malloc?
256
+ // If we used a custom allocator, we free it here.
257
+ // But LLVM `coro.destroy` handles it.
258
+ // We should call `llvm.coro.destroy(hdl)` if task is dead?
259
+ // But we can't easily call LLVM intrinsic from here.
260
+ // We assume LLVM code cleaned up via `coro.free` path
261
+ // when task reached end.
262
+ // If task is collected BEFORE completion, we might leak the coroutine frame.
263
+ // For now, simple free of ObjTask struct.
264
+ FREE(struct ObjTask, object);
265
+ break;
266
+ }
267
default:
268
FREE(Obj, object); // Fallback
269
0 commit comments