From: Phil Frost <phil@ma...> - 2007-03-09 18:19:49
I'm trying to fix a few memory leaks in my program, and I have two
1) When running an app under ObjectAlloc, it seems to print
[whateverinstance description] in the lower pane of the instance
browser tab. However, for any class I've implemented, it seems to
print what appears to be a hex representation of the instance's
memory, despite that I have implemented a description() for my
classes. I was hoping to get some information, like the values of
some attributes, so that I could better guess at which instances are
being leaked. Can anyone suggest a way I might do this?
2) I've read that all top-level objects in a nib are created with a
retain count of 1. I have several classes that load nibs like this:
someOutlet = objc.ivar('someOutlet')
if not NSBundle.loadNibNamed_owner_('Foo', self):
raise Exception, 'could not load Foo nib'
What are the implications of this initial retain count of 1 for a
PyObjC application? So far, I've been assuming that the Right Thing
will happen without considering any PyObjC specific memory
management. My application leaks like mad, which indicates this isn't
exactly correct. I've found in some cases I must do "self.someOutlet
= None" before the top-level object from the nib is freed. Other
times, adding the explicit declaration of the ivar with objc.ivar
seems to allow things to be released and yet sometimes I seem to be
able to get away without it. In short, I'm utterly confused, and
can't find any helpful documentation. Also, I wonder what does happen
to top-level objects in the nib that are not connected to an outlet
on file's owner? Could someone please clarify?
Get latest updates about Open Source Projects, Conferences and News.