Skip to content

Implement ar2DeleteHandleMod: cleanup method needed for trackingMod.c when not using threads #563

@kalwalt

Description

@kalwalt

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.


Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions