[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH/RFC] Fix refcount on some Python callbacks

From: Bert Huijben \(TCG\) <b.huijben_at_competence.biz>
Date: Sun, 13 Apr 2008 13:58:06 +0200

> -----Original Message-----
> From: Jelmer Vernooij [mailto:jelmer_at_samba.org]
> Sent: zondag 13 april 2008 2:11
> To: dev_at_subversion.tigris.org
> Subject: [PATCH/RFC] Fix refcount on some Python callbacks
>

> However, this patch doesn't decrement the reference counter once the
> callback is no longer used since there is no place to free batons as
> far
> as I know. That means we'll potentially keep Python methods around in
> memory that aren't used. Is that a problem or is there perhaps some way
> to work around this?

(I faced a few of the same issues while designing the SharpSvn library)

In some cases it's an option to do the cleanup from an apr pool cleanup function.

I use this for marshalling managed exception instances from the callback handlers back to the caller of the function.
(.NET uses a mark and sweep garbage collector; so I must keep a reference alive).

As all errors have their own root apr pool, their pools are always cleared when svn_error_clear() is called; this makes it possible for the subversion library to clear an exception triggered by managed code.

In SharpSvn callbacks passed to subversion functions are kept alive by the functions calling the subversion functions; so they don't need special treatment. (And they call back into the managed code via a weak reference. This always succeeds as the calling function also has a reference)

(Using the apr pools in a try finally construction around all calls cleans up automatically on almost all thrown exceptions)

        Bert Huijben

>
> Cheers,
>
> Jelmer
>
> --
> Jelmer Vernooij <jelmer@samba.org> - http://samba.org/~jelmer/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-04-13 13:59:13 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.