Explicitly state that GC is not supported in the documentation

Issue #36 resolved
Ronald Oussoren
repo owner created an issue

PyObjC's documentation should explicitly mention that Objective-C garbage collection (GC) is not supported.

The reasons for that:

  • PyObjC's core tries to maintain strong references when GC is active by using CFRetain/CFRelease, but I haven't reviewed if the data structures used are safe w.r.t. GC (CFHashTables and the like)

  • The OC_* classes and generated classes have a -dealloc method for cleaning up (such as Py_DECREF-ing Python objects), but there is no finalize method for use with GC (hence Python references will be leaked)

  • The CFRetain/CFRelease code makes live harder when trying to interact nicely with ARC (that is, it should be possible to use the ARC runtime functions that avoid hitting the autorelease pool when using PyObjC, but using CFRetain makes that slightly harder than I'd like)

  • There might be race conditions when using GC: PyObjC has a data structure that maps ObjC objects to Python objects, those could end up containing references to dead but not yet finalized objects, and that could cause problems later on.

All in all it will take some serious effort to make PyObjC GC-safe. As GC is on the way out (GC is deprecated in OSX 10.8) it is not worthwhile to spent time on this.

Comments (1)

  1. Log in to comment