ARM32 FFI Handle Disposal Failure
Symptoms
I have a Unity app targeting ARM32 Android devices, which experienced memory exhaustion and OOM termination during video playbook operations. Memory profiling revealed that FFI resources were not being properly released, leading to progressive memory accumulation until system limits were exceeded.
Problem
FFI handle disposal fails on ARM32 platforms (armv7), causing resource cleanup issues. All FfiDropHandle() calls return false, preventing proper memory management during operations like video playback.
Root Cause
Type mismatch between C# IntPtr (32-bit on ARM32) and Rust FfiHandleId (64-bit). The current FFI function signature expects a 64-bit handle ID, but receives a 32-bit pointer on ARM32 platforms.
Potential Solution
Platform-specific function signatures, see: https://github.com/holofermes/rust-sdks/commit/4242930d913a0044c227e298bb3b1c12d3a8ff59
This fix should maintain backward compatibility while resolving the handle disposal issue on ARM32 platforms.