[Sparkle] Plan to support garbage collection?
Justin Bur
jbur at druide.com
Fri Feb 15 18:16:52 PST 2008
My cursory experience with a dual-mode plugin is that dual-mode must
be built with Xcode 3 (10.5) and runs on 10.4 or 10.5, but *not*
10.3. By dual-mode I mean checking "GC supported", not of course "GC
required". Developers who require 10.3 support will simply have to
uncheck the box when they build Sparkle and forego GC compatibility.
In the code you have to do precise manual memory management (Sparkle
1.1 had some dubious bits but I haven't checked the trunk to see if
things are better now). As Pierre says, there are no special
functions to call. When GC is active in the host application, the
retains and releases become no-ops and therefore strong links are
required; when GC is not used by the host app, the retains and
releases are functional.
Justin
On Feb 15, 2008, at 16:34, Pierre Bernard wrote:
> Hi all!
>
> I am using Sparkle Plus in a GC application. It works just fine.
> The problems must have been introduces some time after Sparkle Plus
> forked.
>
> There are no special functions to call in order for GC to work. You
> just need to keep ivars pointing at things you want to stick
> around. Don't we always do that anyways? What would be the point of
> retaining something and not a have a reference to it? It would be
> unreachable and thus leaking.
>
> I believe on can write "dual-mode" code pretty easily. No need to
> fork. Leopard based developers will just need to flip the switch in
> xCode.
>
> Best,
> Pierre Bernard
> Houdah Software s.à r.l.
>
> On 15 Feb 2008, at 22:13, Andy Matuschak wrote:
>
>> Oops! Okay, so it turns out this is really hard—I didn't
>> understand before. To make a proper "dual-mode" framework (that
>> is, one that runs linked to both garbage-collected and
>> traditionally-managed binaries), you have to both maintain proper
>> retain counts for all objects in the system and maintain strong
>> links to anything you want to keep track of.
>>
>> Sparkle doesn't really do the latter for a number of things, so
>> these objects (like the appcast, and some of the dialogs) would
>> need to be kept as ivars of the SUUpdater for this to work properly.
>>
>> Even if that work were done, though, the problem is a little more
>> complicated because only the 10.5 SDK has the necessary functions
>> (objc_ivar_assign and friends) to make GC-supported work
>> correctly. But Sparkle supports 10.3 on. So how do we make this
>> work? Separate versions of the framework for 10.3+ and 10.5-gc-
>> only? I'm not totally sure.
>>
>> Does anyone have any experience with creating dual-mode frameworks
>> that run on pre-Leopard?
>>
>> - Andy Matuschak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andymatuschak.org/pipermail/sparkle-andymatuschak.org/attachments/20080215/e594b277/attachment.htm
More information about the Sparkle
mailing list