aapoalas / aapoalas/denonomicon

Expand examples to show FinalizationRegistry usage for binding GC and deallocation

Ouverte
#12 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
33
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I am trying to port a c++ library to deno and I am not clear on how gc with ffi buffers works.

This is a great explanation of how ffi works, but I cannot understand the connection with gc.

I saw this example

https://github.com/aapoalas/denonomicon/blob/5da9957a350e146aec203b93bb8621805569f8c0/examples/cpp/inheritedClass.ts#L225C7-L225C26

but I do not understand how the gc is informed that it needs to call a destructor when the buffer/pointer goes out of scope in deno.

I have done the same in node and a function like this

https://nodejs.org/api/n-api.html#napi_create_external

makes it super easy.

I could not understand what is the equivalent in deno.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.