Closed raedle closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This pull request was exported from Phabricator. Differential Revision: D41919866
This pull request has been merged in facebookresearch/playtorch@623f0f5cab35052fead49f1b2301d2e8d6dd705a.
Summary: The Hermes GC will eventually clean up orphan host objects. This is also the case for
ImageHostObject
, which itself has a reference toImage
that needs to be cleaned up, hence the call to theImage::~Image
destructor. On Android, it will try to release theglobal_ref<JImage>
resource, which at the time, may not run in the JVM thread scope causing an app carsh with an error like:Reported here: https://github.com/facebookresearch/playtorch/issues/175
This change ensures that the image instance release happens within the JVM environment.
More details: https://github.com/facebookincubator/fbjni/blob/5eacdd11c5d9c46f5a752faad3457f3b07fe40cb/cxx/fbjni/detail/Environment.h#L114
Before
https://user-images.githubusercontent.com/489051/206943077-f9b386f8-77c4-42fe-b386-6a084bd47c95.mp4
After
https://user-images.githubusercontent.com/489051/206943085-7edde567-743c-46a7-9e41-ff3e350a4549.mp4
Differential Revision: D41919866