0

I have a project with an empty main() function.

Just by linking frameworks to my project (e.g. ImageIO.framework) Instruments lists un-freed memory allocations after shutdown of my application.

Xcode Instruments

1) Can I hide persistent memory allocations in Instruments which were created by Apple Frameworks, so I can concentrate on my memory leaks?

2) Is this intended because Apple knows the OS cleans up afterwards anyway?

HelloWorld
  • 2,392
  • 3
  • 31
  • 68

2 Answers2

1

Regarding 1 - choose "All Heap allocations" at Allocation Type (and not All Heap & Anonymous VM).

Regarding 2 - even Apple has some memory leaks..but yes, it's would be freed after app's shutdown.

Witterquick
  • 6,048
  • 3
  • 26
  • 50
1

1) You can be the owner of an object which is created by a framework. Read Instruments User Guide, Find Memory Leaks.

2) Yes. Singletons and objects that can be reused, like NSColorPanel, aren't deallocated. Also, it is faster to quit the app without cleaning up. For example, from the documentation of NSManagedObject: "Core Data does not guarantee that dealloc will be called in all scenarios (such as when the application quits)".

Willeke
  • 14,578
  • 4
  • 19
  • 47