Hi, 2008/1/30, Peter Samuelson <[EMAIL PROTECTED]>:
> %typemap(ruby, argout) apr_pool_t *pool > { > svn_swig_rb_set_pool($result, _global_svn_swig_rb_pool); > svn_swig_rb_pop_pool(_global_svn_swig_rb_pool); > } > > This isn't really output parameter processing (hint: it doesn't > assign to $result), it is merely abusing an argout typemap > to apply some final processing AFTER all "real" > output parameters have been processed (and accumulated > in $result), but BEFORE the final "return $result". > This works since apr_pool_t* parameters > are generally the last parameter in SVN and APR functions. > > Note that this approach is rather specific to Ruby. Python does > the equivalent processing in a freearg typemap (line 319). > (freearg typemap code is emitted at roughly the same place > as the code for the final argout parameter.) > But Ruby probably can't just switch to a freearg typemap, > because it requires access to $result which isn't available > in freearg typemaps (though I don't understand what > svn_swig_rb_set_pool does with $result). This is for GC. The ruby bindings create a pool for each method call. The pool is owned (referenced) by $result not self. If self ownes the pool, the pool is never GCed until self is GCed even if $result that uses memory in the pool is GCed. If $result ownes the pool, the pool will be GCed when $result is GCed even if self isn't GCed. Solution: 1) use 'vresult' instead of $result. :< 2) ask for reverting the SWIG change and mark SWIG 1.3.33 as 'not supported'. 3) come up with any other implementation idea. Thanks, -- kou -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]