How can I avoid "Context leak detected, CoreAnalytics returned false" when using MPSGraph?

Hi.

Excuse me for no reprodcution code.

My app on macOS Monterey runs MPSGraph#run repeatedly. For a minutes, Xcode console shows "Context leak detected, CoreAnalytics returned false" repeatedly and the system slows down.

Do I need to release some resource for each calling of run method?

Thanks

Post not yet marked as solved Up vote post of y_ich Down vote post of y_ich
1.5k views

Replies

Hi y_ich,

It is possible that the problem you describe could be caused by a memory leak related to the lifecycle of the MPSGraph. I would recommend starting the investigation there.

Unfortunately, we can't help you diagnose further without a reproducing project. If you could prepare one for us, we can help narrow down the problem.

Wrapping the related code by autoreleasepool solved this issue. I have never known existence of autoreleasepool in Swift.

  • Thanks for this, autoreleasepool fixed the issue for me.

Add a Comment