Re: Introducing "toggle references"



Alexander Larsson said:
> On Mon, 2005-04-25 at 22:18 -0400, Owen Taylor wrote:
>> On Tue, 2005-04-26 at 02:01 +0200, Tim Janik wrote:
>> > objects kept alive purely by proxy links shouldn't be interesting
>> > to language bindings, so they can drop their proxies with ref_count==1.
>>
>> I had that thought, but it doesn't work out ... GObjects kept alive
>> only by proxy links *are* interesting. In a situation like:
>>
>>         Language Runtime A                Language Runtime B
>>                             |           |
>>                             |           |
>>  Other object --> Proxy A <--- GObject ---> Proxy B
>>                            --->        <---
>>
>> If we weaken the references from the GObject to the proxies, then
>> Proxy B will be collected prematurely.
>
> Is this such a huge problem though? In this case we'll collect B
> prematurely in this case. But this is what the current solution that
> Gtk# uses does in this case, and that doesn't seem to hugely impact Gtk#
> users.
>
> With your proposal you would instead never be able to collect either of
> the proxies or the GObject. They will be leaked forever.

Or until one of the runtimes goes away.

Imagine a Gtk# program that runs a module or plugin implemented in perl.


> On the other hand, maybe leaking such shared objects isn't a huge
> problem. I mean, if you're already using two language runtimes, whats a
> few objects more or less...

Depends on what the resource is.  For non-gtk+ GObjects, artificial life
support like this can cause problems (sockets that stay open too long, device
resources that don't shut down, etc).



-- 
muppet <scott at asofyet dot org>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]