Surround your threaded code with NSAutoreleasePool *pool = NSAutoreleasePool alloc init; //threaded code.... pool release.
Surround your threaded code with... NSAutoreleasePool *pool = NSAutoreleasePool alloc init; //threaded code.... pool release.
............... – grunge fightr May 1 at 10:15.
Classic producer/consumer problem. Your producer thread is probably outrunning the main thread (the consumer). I'd recommend keeping a queue of images (instead of the single mImage), guarded by a lock which you enqueue images onto (from your background queue), and dequeue images from your main queue.
Or you could use GCD, which makes this even easier. Instead of using mImage to hold onto the created image, you could just use a block which would retain the image and then set it on your image view in the main queue. Something like: thread2loop() { NSAutoreleasePool *pool = NSAutoreleasePool alloc init; while (...) { __block id self_block = self; // (don't want to retain self in the block) UIImage *img = UIImage alloc initWithCGImage:quartzImage scale:1.0 orientation:UIImageOrientationUp; dispatch_async(dispatch_get_main_queue(), ^{ block_self.imageView.
Image = img; img release; }); } pool drain; // release is outdated for autorelease pools } Warning: Doing this too much will quickly run the device out of memory and cause your app to be killed. You probably want to make sure that your use of this technique is limited to creating a small number of images.
It is not such case - the two are synchronized by performSelectorOnMainThread: waitUntilDone: YES- it is called like normal synchronous function calls - the problem I think is in releasing image in uiImageView, nilling it seem to not give a result in releasing it – grunge fightr May 2 at 22:15 Correct you are, it should be synchronized in that instance. Wild guess, have you looked to make sure that your imageView is being released properly? It would be helpful if you posted more code.
– Ian Baird May 3 at 5:40 imageView will be released at the end of the app; I think I need to release imegeView's . Image and don't know how to do it - as far as I know setting new image to . Image rekeases previous image setted but I had leaks (raported in Instruments) still – grunge fightr May 3 at 6:53.
Classic producer/consumer problem. Your producer thread is probably outrunning the main thread (the consumer). I'd recommend keeping a queue of images (instead of the single mImage), guarded by a lock which you enqueue images onto (from your background queue), and dequeue images from your main queue.
Or you could use GCD, which makes this even easier. Instead of using mImage to hold onto the created image, you could just use a block which would retain the image and then set it on your image view in the main queue. Warning: Doing this too much will quickly run the device out of memory and cause your app to be killed.
You probably want to make sure that your use of this technique is limited to creating a small number of images.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.