|Subject:||Re: Question about memory management|
|Date:||Tue, 4 Jun 2013 02:58:39 +0200|
On 4. 6. 2013., at 02:14, Maxthon Chan <address@hidden> wrote:
Can you compile it with -fobjc-arc and check again? Probably with ARC you can have some ideas.
When you're not sure how something is memory managed, compiling with ARC is probably a terrible idea.
Turning magic into even-more-magic doesn't help learning. :)
On 4. 6. 2013., at 01:33, Germán Arias <address@hidden> wrote:
GSAutocompleteWindow *window = [GSAutocompleteWindow defaultWindow];
The method is named +defaultWindow; it does not include "alloc", "create", "new"; hence its retaincount is "+1 (-1)", which is how I denote "currently 1, but autoreleased once".
If the method name included "alloc", "create" or "new", the retaincount would be"+1 (0)", which is how I denote "currently 1, and not autoreleased".
+defaultWindow implementation should be approximately:
return [[[self alloc] initXYZ:abcd] autorelease];
If it is not autoreleased, then that's the problem.
Since it's autoreleased, I'd advise retaining the window, and later releasing it where appropriate (after the window is closed) -- despite the fact that the window might be retained while it's displayed. I don't know enough about internals of NSWindow or management of NSWindows under GNUstep to think about that... at least not yet. (GSoC will, for me, prove interesting in that regard. :))
Anyway, if -release is never called, then I'd first wonder: how do you close the window? Apple's docs for the -close method state:
P.S. I'm really looking forward to whatever you're coming up with... it'll be far better than wrestling with inability to add GS coding standards to Vim, and then wrestling without autocomplete :-)
|[Prev in Thread]||Current Thread||[Next in Thread]|