Mediapipe: Memory leak with handtracking iOS

Created on 12 Jan 2020  路  9Comments  路  Source: google/mediapipe

I found a memory leak on example project for iOS.

  • Model: iPhone 11 Pro
  • iOS: 13.3
  • Xcode: 11.3
  • mediapipe: v0.6.8
  • bazel: 1.1.0
  • tulsi: 0.20190814.88
  • Scheme: HandTrackingGPUApp
  • 3D / 2D both

image

Message from debugger: Terminated due to memory issue
ios

Most helpful comment

While release is coming please use the quick fix: replace a single line https://github.com/google/mediapipe/blob/3b6d3c40589968c8333b4a936fbad7a8bea6d7f6/mediapipe/framework/scheduler_queue.cc#L28

with this code:

ifdef __APPLE__

define AUTORELEASEPOOL @autoreleasepool

else

define AUTORELEASEPOOL

endif // __APPLE__

All 9 comments

I can reproduce the issue. We experience leaks with our graphs on iOS as well.
It seems no CPU-only apps are leaking nor is the edge detection example app.

mediapipe v0.6.8.1
Xcode 11.3.1
iOS 13.3.1 (17D50)
Model: iPhone 6s

  • ObjectDetectionCpuApp: no leaks
  • ObjectDetectionGpuApp: crashes with

validateComputeFunctionArguments:771: failed assertion `Compute Function(ComputeFunction): argument size[0] from buffer(7) with offset(0) and length(12) has space for 12 bytes, but argument has a length(16).'

  • EdgeDetectionGpuApp: no leaks
  • MultiHandTrackingGpuApp: leaks by allocating about 30MB/s
  • HandTrackingGpuApp: leaks
  • HandDetectionGpuApp: leaks
  • FaceDetectionGpuApp: leaks
  • FaceDetectionCpuApp: no leaks

We are affected as well. ObjectDetectionGpuApp is crashing with exactly the same error.
Could we get some more attention to the issue, @mgyong?
@fenollp, do you have an idea when the problem was introduced?

We're seeing the same thing on MultiHandTrackingGpuApp, Xcode 11.3.1, iOS 13.3.1, iPhone 11 Pro. The leak happens in both Debug and Release, but NOT when open in Instruments (regardless of which Instruments are active), which makes this well nigh impossible to actually debug.

The leak is fixed in upcoming release

Great to hear! Is the fix on the staging branch, or another fork, or is it not available yet? Any chance of posting the fix if it's not available on GitHub yet? It's be really great to get this ASAP.

While release is coming please use the quick fix: replace a single line https://github.com/google/mediapipe/blob/3b6d3c40589968c8333b4a936fbad7a8bea6d7f6/mediapipe/framework/scheduler_queue.cc#L28

with this code:

ifdef __APPLE__

define AUTORELEASEPOOL @autoreleasepool

else

define AUTORELEASEPOOL

endif // __APPLE__

Thank you!

For anyone confused by the automatic markdown parsing, that's supposed to be:

#ifdef __APPLE__
#define AUTORELEASEPOOL @autoreleasepool
#else
#define AUTORELEASEPOOL
#endif // __APPLE__
Was this page helpful?
0 / 5 - 0 ratings