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
I have the use-case that I build a hxcpp DLL that I load in Godot as an extension (https://hxgodot.github.io).
Each haxe-bound engine class constructs a binding object in the engine and retains the pointer to the engine data. It works great during normal runtime with some GC Root trickery, and pointers of engine objects are being released when the finalizers run.
But things get tricky when the engine is shutting down. Even after clearing the GCRoots, GC might still be holding on to an object that contains a pointer, that needs to be released in the engine. And when the finalizer finally runs, the necessary stage/environment to release the pointer is gone and the engine tracked this as a leaked object.
I noticed that the whole boot/shutdown of hxcpp is not really symmetrical and shutdown / unregister is missing. So I guess I would have to add some code that involves the GC. Do you have any clues for me on how to go about this, esp. when it comes to GC?
Ideally I would want to signal hxcpp to release everything that is still being held on, thus enabling a coordinated shutdown & release.
The text was updated successfully, but these errors were encountered:
I have the use-case that I build a hxcpp DLL that I load in Godot as an extension (https://hxgodot.github.io).
Each haxe-bound engine class constructs a binding object in the engine and retains the pointer to the engine data. It works great during normal runtime with some GC Root trickery, and pointers of engine objects are being released when the finalizers run.
But things get tricky when the engine is shutting down. Even after clearing the GCRoots, GC might still be holding on to an object that contains a pointer, that needs to be released in the engine. And when the finalizer finally runs, the necessary stage/environment to release the pointer is gone and the engine tracked this as a leaked object.
I noticed that the whole boot/shutdown of hxcpp is not really symmetrical and shutdown / unregister is missing. So I guess I would have to add some code that involves the GC. Do you have any clues for me on how to go about this, esp. when it comes to GC?
Ideally I would want to signal hxcpp to release everything that is still being held on, thus enabling a coordinated shutdown & release.
The text was updated successfully, but these errors were encountered: