Obvious leaks: png_malloc

I have an application with various animations and images. The application works fine for about 30 minutes, but then crashes. I looked through the tools and I notice that every time I mark a bunch (as much as about 300 kB every couple of minutes), a whole bunch of distributions are created in the amount of 7 KB png_malloc .

I noticed in my leaks that every time an animation or png used for the first time, there seems to be a "data leak" (although I'm a little skeptical about whether this is a real leak or not).

All of these images were declared using

 frameName = [[NSString alloc] initWithFormat:@"image.png"]; UIImage * u = [UIImage cachelessImageNamed:frameName]; 

therefore, I do not think that the problem with image caching should be.

png_malloc anyone else had the same issue with this png_malloc distribution?

Screenshot

* Notes: I use an arc, and animations become nil in the release function; however, they are not called until the application exits. Does this create a problem every time an animation starts if it was created only once?

EDIT Another code:

 -(void) createSymbolAnimations { if (symbolAnimations == nil) { symbolAnimations = [[NSMutableArray alloc]init]; } NSString * frameName; if (thisAnimation == nil) { thisAnimation = [[NSMutableArray alloc] init]; } for (int x= 0; x< 40; x++) { frameName = [[NSString alloc] initWithFormat:@"image%d%s",x,".png"]; UIImage * u = [UIImage cachelessImageNamed:frameName]; [thisAnimation addObject:u]; } [symbolAnimations addObject:thisAnimation]; } 

It is the creation of animation. Imagine that I have several of them, and then I change the set of animations and start the animation by touching this fragment:

 UIImageView * aView = [frameArray objectAtIndex:x]; aView.image = [[symbolAnimations objectAtIndex:x]objectAtIndex:0]; [aView startAnimating]; 

Where x is the set of images I want to animate, and 0 is the first frame of the animation.

So, the image changes quite a few times, and I start to worry that every time the animation images change, the RAM is not cleared, but is overwritten instead.

EDIT Image Engraver

 +(UIImage *) cachelessImageNamed: (NSString *) name { return [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:name ofType:nil]]; } 
+4
source share
1 answer

Just in case someone stumbles upon this later, I found a problem.

The pngs used in this project for animations were created on Windows (not sure if this is appropriate), and it seems that the file format is slightly different from what Xcode expects. This prohibits the release of any png. If you convert the format to png for Mac, it works fine. I made it through

  mogrify -type truecolormatte -format png *.png 

After setting up all my images, the leaks were significantly reduced, and everything seems to be working fine.

+4
source

All Articles