On Wed, Nov 3, 2010 at 8:52 AM, Matt Sergeant <matt@...> wrote:
> Sherm Pendley wrote:
> On Tue, Nov 2, 2010 at 4:48 PM, Sherm Pendley <sherm.pendley@...>
> On Tue, Nov 2, 2010 at 1:39 PM, Matt Sergeant <matt@...> wrote:
> Just a simple question - when do I need to retain()/release() things in
> CamelBones? I assume it's not done automagically?
> It's semi-automatic. When an Objective-C object is passed to Perl, a
> Perl object "wrapper" is created and a -retain is sent to the ObjC
> object. When the "wrapper" object is destroyed by Perl (which happens
> according to Perl's normal scoping & reference counting rules), its
> destructor sends the corresponding -release to the object it wraps.
> Okay, that's the intent at least... reviewing the relevant code, it
> appears that isn't actually happening. :-(
> Can you expand on that?
I haven't looked at that code in a couple of years, but a quick review
of it doesn't turn up any of the relevant -retain or -release calls,
nor is there a DESTROY() method in the relevant Perl code. I know what
*should* be happening, but it doesn't look like the code actually got
done. I suspect it's something I intended to do, but didn't finish due
to my meltdown/burnout. :-(
On the other hand, I've been rewriting some parts of ShuX - the
browser panel, so that it shows the contents of the PAR kits, among
other things - and haven't been getting any hard crashes that would
indicate over-released objects. That's the good news. Opening and
closing a bunch of modules with it *does* increase memory use, though,
so there are certainly memory leaks.
Cocoa programming in Perl: