title: Receive memory warning after 10 or 11 times capturing image using UIImagePickerControllerSourceTypeCamera in iphone
body: <p>Hi I receive memory warning whenever I am using camera.</p>
  
  <p>The error is like this:</p>
  
  <pre><code>"Receive memory warning..."
  </code></pre>
  
  <p>And the code is:</p>
  
  <pre><code>-(void) getPhoto{
  
      GameAppdelegate *appDelegate = (GameAppdelegate *)[[UIApplication sharedApplication]delegate];
  
      UIImagePickerController * picker = [[UIImagePickerController alloc] init];
      picker.delegate = self;
      picker.allowsEditing = YES;
  
      ///////////////////////////////////photolibrary//////////////////////////////
      if([appDelegate.photoselection isEqualToString:@"User Pressed Button 1\n"])
      {
          picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
  
          if(appDelegate.sound == 1)
          {
              [classObj ButtonSound];
          }
      }
      ///////////////////////////////////Camera//////////////////////////////
  
      else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 2\n"]) 
      {
  
          @try 
          {
              picker.sourceType = UIImagePickerControllerSourceTypeCamera;
          }
          @catch (NSException * e)
          {
              UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"ALERT" 
                                                           message:@"Please try again"
                                                          delegate:self 
                                                 cancelButtonTitle:nil 
                                                 otherButtonTitles:@"ok", nil];
              [av show];
  
          }
          if(appDelegate.sound == 1)
          {
              [classObj ButtonSound];
          }
      }
      ///////////////////////////////////Cancel//////////////////////////////
  
  
      else if([appDelegate.photoselection isEqualToString:@"User Pressed Button 3\n"]) 
      {
          if(appDelegate.sound == 1)
              [classObj ButtonSound];
          return;
      }
      [self presentModalViewController:picker animated:YES];
      [picker release];
  }
  </code></pre>
  
  <p>How can i handle this?please help after taking picture i crop the image and save in application like this:</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
  
      iRolegameAppDelegate *appDelegate = (iRolegameAppDelegate *)[[UIApplication sharedApplication]delegate];
  
      if(appDelegate.sound == 1)
      {
          [classObj ButtonSound];
      }
  
      [picker dismissModalViewControllerAnimated:YES];
      imageView.image = image;
      CGSize size = [imageView.image size];
      CGRect cropRect = CGRectMake(0.0, 0.0, size.width, size.height);
  
      NSValue *cropRectValue = [editingInfo objectForKey:@"UIImagePickerControllerCropRect"];
      cropRect = [cropRectValue CGRectValue];
  
      appDelegate.slectedimage = image; 
      imageView.hidden = YES;
  
      if( [appDelegate.Name length] != 0 &amp;&amp; max_att == 15)
      {
          btnNotDone.hidden   = YES;
          btnDone.enabled = YES;
      }
  
      //IMAGE SAVE IN DOCUMENTS//////
      [UIImagePNGRepresentation(image) writeToFile:[self findUniqueSavePath] atomically:YES];
      // Show the current contents of the documents folder
      CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);
  
  
  
  
  }
  </code></pre>
  
  <p>Please help me. I want to remove all warnings.</p>