You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
AssemblyScript/assemblyscript#1256 introduced a new GC hook that runs before managed objects before being collected.
This is helpful for Response objects, whose handles have to be manually closed right now, and in theory, we could remove this requirement by implementing the finalizer.
The issue is that Response objects don't seem to be collected - i.e. the console log is never executed here.
@globalfunction__finalize(ptr: usize): void{// @ts-ignoreif(__instanceof(ptr,idof<Response>())){Console.log("running finalizer with ptr: "+ptr.toString())// change type to `Response` and call `close`}// @ts-ignore__collect();
Manually keeping track of Response objects and the collected pointers, it's clear that they are not collected with the current implementation, which could be an indicator that we are actually leaking memory.
Another question is related to manually calling __collect - without manually calling it, the finalizer hook is not always executed. Are there any best practices around manually calling it or not?