Cool Feature but crashes because of memory leak
I've tried the app and also added the relevant stuff to my main app. It all works perfectly but after some seconds I can see in XCode the memory usage sums up to over 2GB and then the app crashes (which is normal behavior). I tried just to draw a square, hoping that the blurring is memory intense, but no success. Must have to do something with the constantly analyzing of each frame. Testing device was iPhone XS. Tested it also on an iPhone 16 Pro Max, and after 3GB it turns back to 800Mb and stays stable without crashing. So I guess older models with lower RAM are not supported? Or is there any ways to lower the frame size?
- Thanks!
- You can easily lower the Frame size by using VisionCamera's APIs.
useCameraFormatwith a lowervideoResolutionfor example. - The actual memory "leak" is not a leak per-se, but simply a confused GC not knowing that it has to delete stuff from memory in-time because external memory is not tracked. This will be fixed once I rewrite VisionCamera to Nitro, since Nitro has proper memory management even for external allocated memory.
To be fair, I haven't seen apps crashing using VisionCamera Frame Processors in my client apps - so it might also be something in your app going wrong. But either way, with the Nitro rewrite it will definitely work.