NSMutableArray release Problem

Hello Guys,

I am stuck in crashes. I m doing following thing in a function

NSMutableArray *myMutableArray=[[NSMutableArray alloc] initWithCapacity:0]];

for (int i=0;i<10;i++)
[myMutableArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat😠"img000%d.png",(start+i+1)] ofType:nil]]];

self.myImageView.animationImages=myMutableArray;

[myMutableArray removeAllObjects];

//[myMutableArray release];

I have around 50 images and I load only 10 at a time for a purpose, I am controlling this my "start" variable which contains the initial point. And I want to free previous loaded images while loading new ones.

But when I uncomment the release method My program crashes..
And if I do not release My memory is not being freed, as I checked in Instruments, although there is not leak in Leaks but still object allocation goes on and on with overall system memory of 100 MB. And because of this I get Low Memory Warning in program when I test in the device. I don't know what is the problem here. Please let me know if anyone has resolution.

Thanks in advance.

Regards,
Sanniv.
Hey Guys, Waiting for resolutions!!!!
Please give ur suggestions...
I'm not sure the error is in the code snippet that you show. Could you put this code snippet in a new project and see if you get the same crash behavior when you do the release? For purposes of this test, don't have the line:
self.myImageView.animationImages=myMutableArray;
Problem Solved

I got the solution for my problem
wwwDOTsannivs-iphone-programming-tipsDOTblogspotDOTcom
Use NSMutableArray *myMutableArray=[NSMutableArray array]; and it will autorelease when you're finished using it.

Original thread: https://forums.imore.com/threads/nsmutablearray-release-problem.171278/