Question: If I create a UILabel programmatically, is it necessary to release it afterwards? E.g.,

```
UILabel *label =  [[UILabel alloc] initWithFrame:...];
[self.view addSubView:label];
[label release];  // <-- is this needed?

```

I found [this thread](https://stackoverflow.com/questions/6634612/ios-create-uilabels-dynamically) that included the release line, but I understand that this works differently in the newer iOS versions. 

Thanks for reading.

Answer: 
Yes you need to release it unless you are using ARC.  

In this case when you `alloc` your retain count is 1.  

When you do `addSubView` the view will `retain` your label : Retain count is 2.  

So at that point you are free to make the `release` to balance out your `alloc` retain count is now 1.  

But that 1 is `own` by `self.view` and it will call release when it doesn't need it anymore.  

When that happen the retain count of your label will drop to 0 and it will be `deallocated` and it's memory will be free.
If your project is setup to use ARC (automatic reference counting) then you will get an error trying to add the call to `release`. If you don't get any error trying to add that line then you are not using ARC and you do need that line to avoid a memory leak.