-
Notifications
You must be signed in to change notification settings - Fork 102
App crashes with memory leak when running for a long time #158
Comments
@SomaKishimoto, I can't repro the issue with the provided code and an iPhone Xs (see screenshots at the start of the memory measurement and after 1 hour continuously running the code).
StartEnd |
@raedle , thanks for trying to repro the issue.
setting
Memory heap seems to increase slightly once every 10 minutes. Start30min55min
|
Hi, @raedle, |
@nh9k, each image has to be released from memory manually. For context, the current implementation holds a reference in the JSContext:
Not releasing the image will keep the reference around. Tensors are implemented differently. They use Have you profiled your app to check what leaks memory? |
@raedle, thank you for your kindness! I haven't profiled my app yet. My app also crashes, so I need a memory check. I'll report back! |
Hi, @raedle, i found out what leaks memory!!! This code causes app crash when capture For example, the size of an image are
Here is a Snack for test. 😢 |
Thanks for investigating in the issue, @nh9k. My hunch is that it is not a memory leak per se, but the Hermes/JSC garbage collector will not run in fast enough intervals to free memory of variables that are out of scope (i.e., the This seems like a valid case for introducing manual memory management options to PlayTorch (although this will break with idiomatic JavaScript). |
Thanks @raedle. |
Version
0.2.2
Problem Area
react-native-pytorch-core (core package)
Steps to Reproduce
Following the steps below, the memory heap increases at a pace of about 100MB per hour. We are developing an application that needs to run for long periods of time. Could you please tell me how to avoid this issue.
However, the code below is necessary for our application and cannot be removed.
Expected Results
No response
Code example, screenshot, or link to repository
Related to this issue
The text was updated successfully, but these errors were encountered: