RE: AW: Python bindings: Use of svn_swig_py_make_stream() - avoiding leaking fds
From: Bert Huijben <bert_at_qqmail.nl>
Date: Tue, 10 May 2011 17:08:56 +0200
> -----Original Message-----
Well in some cases it is a user level thing.
Swig python wants to receive a close event to release resources, but our streams don't close in this specific case.
Earlier I suggesting such a function, to allow the python bindings to request this close on pool cleanup.
(And we had this discussion earlier... when we were discussing if we should use the close event to install a new pristine file)
We kept the definition of streams very generic in the past (read: before 1.0), to allow reusing the concept everywhere.
And now with 1.7 we start adding new requirements.
Personally I don't think we shouldn't add pool cleanups everywhere because some code might need it.
For .Net Microsoft recommends using finalizers *only* when you have to directly release unmanaged resources like file handles. So you use them in the low layers where you are managing resources, not high up the chain where you are just wrapping lower layer.
I think we should apply the same rule here: Use pool cleanups when necessary, not by default.
The python bindings need it, so I would say: Add it there.
(And maybe make it easier to use from other bindings when it proves useful. That is why I suggested adding the function in svn_stream.h)
Bert
|
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.