Xcode Swift: Resetting zone allocator - Memory

Hello everybody,

Since I have been working on an app for quite some time now. This week I update to iOS 14.1 and updated Xcode to support this latest version.

Also, I have been doing some changes when it comes to user interface, the app flow and how I manage my core data entities.

I don't know if this two previous things are related in anyway but when I run the app on the device for the first time I get unexpected behaviour and the message:

Code Block
[Memory] Resetting zone allocator with 68631 allocations still alive

If I continue using the app and let it stay on my iPhone it never happens again. I can launch it how many times I want and I don't get any crash or unexpected behaviour.

This is what intrigues me.

I tried locking for the issue in the Instruments app and I see a memory leak with the responsibility message "Allocated prior to attach." I can't figure out what this means.

Has anyone experienced anything similar?

Cheers,

Replies

Can you spot the part of code that triggers the error message ?
I know where it happens and how to make it happen. But I don’t get any error message that takes me to specific line of code or view.

How would you try to solve it?
In case it helps, that "[Memory] Resetting zone allocator ..." message comes from geo::MallocZoneAllocator::reset() in VectorKit.framework. It pertains to memory zones used in maps-related functionality. I work on Dev Tools not maps so I don't know what triggers that call to reset() or what it means. I don't think Instruments will be able to narrow down what is causing that.

You said "I tried looking for the issue in the Instruments app and I see a memory leak with the responsibility message 'Allocated prior to attach.' I can't figure out what this means." That leak is not necessarily related to the "Resetting zone allocator" message. When you used Instruments, did you attach to an already-running process, or did you launch the process from the Leaks template? Instruments has no way to get backtraces of allocations that happened before attaching, or that happen early in launching prior to when the Allocations instrument is initialized. So if you attached and the memory that was leaked had already been allocated, you won't see a backtrace. You may be able to get a backtrace for it by launching from Instruments.