[vm/ffi] allocate free when adding finalizers in Dart #43038
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
We have exposed native finalizers through dart:ffi (6544c69 and 7eac9f3), which enables users to write finalizers in C/C++.
We might still want to expose finalizers in Dart as well (#35770). However, on Windows looking up
free
in different dynamic libraries and the DartVM results in a differentfree
that can only be called on memory allocated with themalloc
in the corresponding dynamic library.Therefore, we use a Windows API for allocating and freeing on Windows currently in
package:ffi
:However, this function does not have the same signature as
malloc
andfree
.We should consider having a free-symbol in the DartVM that uses mimics this behavior but just has the
free
-signature. (The same for allocate.)And then it might make more sense to move allocate/free to
dart:ffi
instead ofpackage:ffi
.The text was updated successfully, but these errors were encountered: