Could someone give me some advice why I have a memory leak associated to this line:

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you look at the warning from Build and Analyze, you’ll notice that the warning actually applies to line 38 of your code, not line 39, on which the message is being shown.
On line 38 you call
alloc, that is, you allocate memory for aUIImageView.Every
alloc,new,copy, andretainrequires a matchingreleaseorautorelease. So, the compiler is warning you that you have calledallocbut haven’t called a correspondingreleaseanywhere.You can add an
autoreleaseto line 38 like so:If you don’t want to use
autoreleasethen you can use something like this:The only real difference is that
autoreleasewaits until the end of the run loop when the autorelease pool drains, whereas callingreleasewill potentially release the memory sooner.