10

I'm creating a UITextView:

greetingTextView = [[UITextView alloc] initWithFrame:greetingRect];

Using it fine, but when the ViewController it is attached to deallocs I'm getting memory leaks ONLY in iOS 7 ? I'm even Nulling the greetingTextView out of desperation but to no effect:

    [greetingTextView.undoManager removeAllActions];
    greetingTextView.delegate = Nil;
    [greetingTextView removeFromSuperview];
    greetingTextView = Nil;

The leaks are in this image:

enter image description here

So it appears something to do with the UITextView UndoManager ? But why only in iOS 7 ?

Regards

Marco
  • 6,692
  • 2
  • 27
  • 38
Aardvark
  • 608
  • 5
  • 15
  • did you find the answer? I am also facing the same issue – Max Nov 06 '13 at 23:47
  • Sorry no :( , maybe it;s a feature lol – Aardvark Nov 09 '13 at 09:33
  • I have the same problem, do you have any new information about this specific issue? – kolpazar Dec 05 '13 at 19:55
  • Experiencing the same stuff, no solution for now. – Misha Karpenko Jan 10 '14 at 12:48
  • Nil is not the same as nil – powerj1984 Feb 15 '14 at 20:26
  • technically Nil and nil are different, nil is the id of a null instance and Nil is the the id of a null class, but in practice they are defined thus so it makes no difference in this case: #define nil __DARWIN_NULL #define Nil __DARWIN_NULL – Aardvark Feb 16 '14 at 06:14
  • I'm getting the same leak. Maybe its a bug in iOS7? (I see its also there in iOS7.1) – Peter Johnson Mar 17 '14 at 16:13
  • And I've tried rewriting a totally new sample that just sets up an editable UITextView. As soon as you edit the text then exit the viewController it leaks the undoManager as shown above. I also tried a few bits of sample code from elsewhere (e.g. Ray Wenderlich) and it has exactly the same issue. – Peter Johnson Mar 26 '14 at 14:22

3 Answers3

0

I face a similar situation, and after hunting around and some trail and error, i noticed that when ARC is disabled for that particular file, the strange behavior stopped and no memory leaks occurred. check here for how to disable arc for a particular file

Community
  • 1
  • 1
dotKwame
  • 181
  • 3
  • 13
0

You'll need to empty out the undo manager if you want any object you add to it to be released.

Review the steps laid out in this document :

https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/UndoArchitecture/Articles/CleaningUndoStack.html

Bryce Buchanan
  • 279
  • 1
  • 10
0

It did occurs to me once when I didn't specify the delegate of a UITextField. After the delegate was set everything went normal. Hope it helps. BTW, I'm using Storyboard.

Nero
  • 1