Problem
The codebase currently misses a required cleanup method for the AR2 tracking handle in non-threaded operation. Specifically, when invoking the teardown method in ARToolKitNFT_js.cpp, there should be a way to properly free memory and resources associated with the AR2 handle. Normally, this would be handled via ar2DeleteHandle, but in the current implementation in trackingMod.c, threads are not used, so the standard ar2DeleteHandle cannot be used directly or may not fit.
Proposal
- Implement a function called
ar2DeleteHandleMod in emscripten/trackingMod.c.
- This method should take responsibility to free and cleanup all resources allocated in
ar2CreateHandleMod and related non-threaded tracking handle structures.
- Ensure that there are no memory leaks and that the function is robust for situations where only single-threaded tracking is performed.
- The function signature should be similar to
ar2DeleteHandle (e.g., taking a pointer to the handle to be deleted).
- Document usage in comments, especially differences from
ar2DeleteHandle.
References
Motivation
Implementing ar2DeleteHandleMod will improve memory management and reliability in the library's non-threaded use case. This change is required to allow correct teardown/cleanup and to avoid possible memory leaks in the NFT tracking pipeline.
Problem
The codebase currently misses a required cleanup method for the AR2 tracking handle in non-threaded operation. Specifically, when invoking the
teardownmethod inARToolKitNFT_js.cpp, there should be a way to properly free memory and resources associated with the AR2 handle. Normally, this would be handled viaar2DeleteHandle, but in the current implementation intrackingMod.c, threads are not used, so the standardar2DeleteHandlecannot be used directly or may not fit.Proposal
ar2DeleteHandleModinemscripten/trackingMod.c.ar2CreateHandleModand related non-threaded tracking handle structures.ar2DeleteHandle(e.g., taking a pointer to the handle to be deleted).ar2DeleteHandle.References
Motivation
Implementing
ar2DeleteHandleModwill improve memory management and reliability in the library's non-threaded use case. This change is required to allow correct teardown/cleanup and to avoid possible memory leaks in the NFT tracking pipeline.