Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-14-2008, 09:47 PM   #3 (permalink)
simsimma
New Member
 
Join Date: Aug 2008
Posts: 9
Default

I think so, here is the code:

Code:
-(BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate>)delegateObject

{
	
    if ( (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
		
		|| (delegateObject == nil) || (controller == nil))
		
        return NO;
	
	
	
    if(imagepicker == nil){
		imagepicker = [[UIImagePickerController alloc] init];
	
    imagepicker.sourceType = UIImagePickerControllerSourceTypeCamera;
	
    imagepicker.delegate = delegateObject;
	}
	
    //picker.allowsImageEditing = YES;
    // Picker is displayed asynchronously.
	
    [controller presentModalViewController:imagepicker animated:YES];
	
    return YES;
	
}
imagepicker is deallocated in the dealloc function of my parent view controller.

Now, after a person takes a photo I do the following:

Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{
	
	//we need to save each image and then show it in the interface!
	int row = (self.numPhotos / 4);
	int mod = self.numPhotos % 4;
	
	UIImageView *imageview = [[UIImageView alloc] initWithImage:image];
    [imageview setFrame:CGRectMake(mod * 80.0, row*120.0 + 120.0, 80.0, 120.0)];
	[self.view addSubview:imageview];
	
	[imageview release];
	
	self.numPhotos = self.numPhotos + 1;
	[self.navigationController dismissModalViewControllerAnimated:YES];

}
From running instruments I see that after I take the image, 8MB or so of space is taken up. But that space never gets released. So each time I take a photo, the memory goes up to hit 40MB which then causes the crash.

What am I doing wrong here? How do I clear the data taken by the UIImagePickerController class so that I'm not causing a crash after 5 pictures?

Cheers
simsimma is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,248
Threads: 39,028
Posts: 171,171
Top Poster: smasher (2,571)
Welcome to our newest member, mitch2702
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:04 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.