Absolutely. I saw that and started looking for crazy complicated answers before
looking for the obvious sensible ones. My case was poor use of
NSTextView/NSScrollView which was creating confusing cross-ownership scenarios
that were difficult to balance in my code.
On Jul 18, 2011, at 5:09 PM, K
On Mon, Jul 18, 2011 at 3:55 PM, Ryan Joseph wrote:
> ;) I was being stupid in that example, I see how my ownership was still
> retained until I called release (for NSTextView.alloc.initWithFrame) and
> removeFromSuperview (for parent.addSubview). Since there's nothing strange
> with NSTextView
;) I was being stupid in that example, I see how my ownership was still
retained until I called release (for NSTextView.alloc.initWithFrame) and
removeFromSuperview (for parent.addSubview). Since there's nothing strange with
NSTextView like I originally thought I just need to pay very close atte
On Mon, Jul 18, 2011 at 3:40 PM, Ryan Joseph wrote:
> In my simplified example this was indeed correct, it was autoreleased and was
> deallocated on the next event cycle. I was convinced there as a problem with
> NSTextView because other views were deallocated instantly but there was good
> rea
In my simplified example this was indeed correct, it was autoreleased and was
deallocated on the next event cycle. I was convinced there as a problem with
NSTextView because other views were deallocated instantly but there was good
reason. I guess I'm just retaining it somewhere that I'll need t
On Mon, Jul 18, 2011 at 2:30 PM, Peter wrote:
> Yes - so the more appropriate question is why it was retained 4 times.
> I don't see Cocoa doing it.
> It's the programmer - mostly.
> Could you give us more code?
>
> Cocoa gives us a very reliable way to know, when an object is released: If
> the
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextUILayer/Tasks/CreateTextViewProg.html%23//apple_ref/doc/uid/2930
On Jul 18, 3:30 pm, Peter wrote:
> Yes - so the more appropriate question is why it was retained 4 times.
> I don't see Cocoa doing it.
> It's the pro
Yes - so the more appropriate question is why it was retained 4 times.
I don't see Cocoa doing it.
It's the programmer - mostly.
Could you give us more code?
Cocoa gives us a very reliable way to know, when an object is released: If the
reference count goes down to 0.
The question now is how to b
You do know about autorelease pools, right? See whether the object survives the
next event cycle. I'm betting it doesn't.
Retain counts are none of your business, as is repeated almost daily on this
list. Don't peek at them, infer nothing from them. Follow the ownership rules,
and you'll be fin
Sure, I get reference counted memory and it could very well be true that Cocoa
has no intent on releasing this at anytime I could expect and that was its
design.
If that's true when I would ask WHEN will it be deallocated? I'm leaking memory
like crazy allocating these objects and would argue i
Le 18 juil. 2011 à 15:26, Ryan Joseph a écrit :
> I literally mean that _exact_ snippet is leaking, 2 lines of code with no
> retaining by any superviews. I only have limited experience with Cocoa and
> don't use Objective C so maybe someone else could test this. Just allocate,
> initialize the
Maybe I am missing something, but given your example - which in some sense
contradicts your comment, why do you expect dealloc to be called?
If the retain count is in fact > 0 after the release (4 in your example below)
dealloc is not called, since the view can not yet be deallocated.
View.relea
I literally mean that _exact_ snippet is leaking, 2 lines of code with no
retaining by any superviews. I only have limited experience with Cocoa and
don't use Objective C so maybe someone else could test this. Just allocate,
initialize then release the object and see if it's ever deallocated. Im
On Jul 17, 2011, at 1:41 PM, Ryan Joseph wrote:
> view := NSTextView.alloc.initWithFrame(NSMakeRect(0, 0, 0, 0));
> // retainCount = 5
> view.release;
> // retainCount = 4, dealloc never called
Impossible to tell from that snippet. Keep in mind that a view’s superview
retains it, so a view in a
Simple question that is causing serious memory leaks in my app. Why given that
example will dealloc never be called? I know the retainCount doesn't tell the
whole story and it may be retained by other objects (rightfully so) but then
WHEN will it be released if not when I request it to? I must b
15 matches
Mail list logo