Cocoa Internals/Memory Management
All Objective-C objects are reference counted objects. Once the count reaches zero - the object is freed.
The modern Objective-C (or Swift) recommends (strongly, fiercely) to use Automatic-Reference-Counting (ARC) support. FPC support for Objective-C was started way before ARC became highly recommended and was part of the language. Right now Objective-C 2.0 syntax provides the language level support for ARC, while FPC doesn't have those (yet?). All Cocoa Widgetset code cannot doesn't rely on ARC and using reference and dereference manually.
ObjC Object Leaks
Free Pascal debugging unit heaptrc is only able to track leaking of memory allocated via Pascal Run-time memory management. It's not able to track allocations made via C-runtime/Obj-C memory manager.
Apple provides an external tools to keep tracking of ObjC allocations.
Xcode Instruments
See Also
- Cocoa Internals
- Advanced Memory Management - at Apple Developer