views:

183

answers:

2

I have a memory leak when i use a UITextView but I don't understand why :

  UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 160, 280, 150)];
  textView.text = @"Hello World";
  textView.editable = FALSE;
  [self.view addSubview:textView];
  [textView release];

Is someone could help me? :S

A: 

When I use the leaks instrument, there is a leak. In the extended details window, the last call to my code is UITextView and it show me 100% of the leak on the alloc and init of the UITextView.

Here is the whole code :

    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(20, 160, 280, 150)];

    [textView setTextColor:[UIColor blackColor]];

    [textView setFont:[UIFont systemFontOfSize:12]];
    // For internationalization.
    textView.text = NSLocalizedString(@"About-Description", @"");       

    textView.textAlignment = UITextAlignmentCenter;

    textView.editable = FALSE;
    [myView addSubview:textView];
    [textView release];

Is it possible that the leak instrument be mistaken and show me the wrong line?

Raphael Pinto
A: 

Bump. I have notice this same thing.

outcast