Thanks Fred. My question is because the page 35 of manual (here http://www.gnustep.org/resources/documentation/Developer/Base/ProgrammingManual/manual_toc.html) say in the section 3.2.2
"
Exceptions
In practice, the extra method call overhead should be avoided in performance
critical areas and the instance variable should be set directly. However in
all other cases it has proven less error-prone in practice to consistently use
the accessor.
There are certain situations in which the rule of having retains and releases
be equal in a block should be violated. For example, the standard
implementation of a container class retain s each object that is added
to it, and release s it when it is removed, in a separate method. In
general you need to be careful in these cases that retains and releases match.
"
OK, I want an app with a text tool, like in Cenon where you have a tool that let you add a text box in your document. I add the text with something like this
NSText *texto = [[NSText alloc] initWithFrame: NSMakeRect(10,10,20,10)] ; [self addSubview: texto] ; RELEASE(texto);
Then, I don't know if I need release this after.
--- El mar 29-jul-08, Fred Kiefer <FredKiefer@gmx.de> escribió:
De: Fred Kiefer <FredKiefer@gmx..de> Asunto: Re: Two questions about NSView class A: ""Germán Arias"" <germanandre304@yahoo.com>, discuss-gnustep@gnu.org Fecha: martes, 29 julio, 2008, 8:55 pm
Did you already get an answer
to these questions?
First of all, in Objective-C you should not be concerned too much about memory. Normally things just happen correctly. When you remove a view from the hierarchy with removeSubView: then that view may or may not be freed. What happens is the it will get releases and if the retain count for the view drops to zero it gets deallocated. The method viewWillMoveToWindow: will be called in that process (as well as in many other cases), but in itself this hasn't much to do with memory management.
For standard GNUstep applications there is a memory usage display hidden in the info dialog. Just click on the image in that dialog.
Fred
-------- Original-Nachricht -------- > Datum: Thu, 24 Jul 2008 23:24:37 +0000 (UTC) > Von: "Germán Arias" <germanandre304@yahoo.com> > An: discuss-gnustep@gnu.org > Betreff: Two questions about NSView class
> OK, the
methods -(void)removeSubview: and -(void)viewWillMoveToWindow: > release > the memory too, or just remove the objects from the receiver?, is there a > way to > see how my app handle the memory? > > > > > > > _______________________________________________ > Discuss-gnustep mailing list > Discuss-gnustep@gnu.org > http://lists.gnu.org/mailman/listinfo/discuss-gnustep
-- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
|