Re: RFC: Reference counts on Gtk2::Tooltips

On Mon, May 05, 2003 at 03:29:53PM -0400, Ross McFarland wrote:
preserving the c behavior will not leak tool tips they will be unrefed and
destroyed when the block in which the var was created goes out of context. in
this way perl does not have the memory leak whereas a similar c program would

But having the tooltip die when the scope ends is exactly what
triped the pitfall in the original example.  Your argument only
holds when the widget (to which the tooltip is attached) is also
local to the scope.  If the programmer cannot take advantage of
block-local variables, how is he to avoid the memory leak?

no, but such things could be added in the wrapper. the problem is if this was
the behavior it would have to be documented, really which ever choice is made
will need to be documented. due to perls garbage collection tips that would
have been leaked in c (where the tips would reside in leaked memory and still
work for the duration of the app) will be cleanned up and disappear. to fix
this would require a change in behavior from the c code that would have to be

I can't think of any plausible case where a programmer expecting the
C behavior would be bitten.  He doesn't have a memory leak where he
though he did.  So what?  Show me an example where the deallocation
will cause a problem.  In a pure Perl program, as long as the
tooltip is needed, there will be a reference, and it will not be


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