iphone - release NSData in NSManagedObject -


I use data modal to store 2 objects: video, images. The video contains only string attributes and images have 2 "binary data" attributes.

Initially, 2 binary data features were in the video object. But loading during all videos UITableView start binary data to 400 videos represent 20 mo, so imagine with 4000 video ...

Now the job of loading UITableView with 2 objects Okay. I binary data load when it is necessary in law: tableView: cellForRowAtIndexPath

But the more I grow up scroll, more memory in this list: (

Look at my method :

  - (UITableViewCell *) tableView: (UITableView *) myTableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * CellIdentifier = @ "videoCell", video * theVideo = (VIDEO *) [ [Self FetchedResultsController] objectAtIndexPath: indexPath]; VideoCellViewController * cell = (VideoCellViewController *) [myTableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (cell == zero) {[NSBundle mainBundle] loadNibNamed: @ "VideoCellview" Owner: Wyn options: zero]; cell = editingTableViewCell; self.editingTableViewCell = nil;} cell.video = theVideo; return cell;}  

and SetVideo method VideoCellViewController

  - (void) Set Video: (Video *) New Video {If (New Video! = Video) {[Video Release]; Video = [Maintain New Video];} NSDTA * ImageData = [Video. Alma Prices: @ "Thumbnail Image"]; UIImage * uiImage = [[UIImage alloc] initWithData: imageData]; SmallImage.image = uiImage; NameLabel.text = video.displayName; [Ui Image release]; }  

Even without setting small images, I have memory problem if I load the image object, it has never released.

I try a lot of solutions for the successor ... (didTurnIntoFault, release, CFRelease ...) without releasing memory in the display device, I can see my. CFData as binary data

I have a lot iPhoneCoreDataRecipes and use PhotoLocations sample

I need help to clean your memory ;.)

Thanks < / P>

Samuel

Obviously something is going on with your table cell creation logic CellForRow delegate handler on a typical first.

  Fixed NSString * MyIdentifier = @ "MyIdentifier" puts a glance; UITableViewCell * cell = [TableWeek Recoverable CellWithIdentifier: MyIdentifier]; If (cell == blue) {cell = [[[Uaitibl Viaisiel Elok] Initvithfrem: Sijiaraksairo Riug Aidentifayr: Maiidentifayr] Otorekves]; } // cell accessories with luggage cell;  

Here we see that we are

  • Attempt to get a reusable cell
  • if it fails (Zero) a new and then pass the reusable id
  • then stuff the cell (new or existing) and return it

If you do not want the cell to reuse the key in the table view, you will always get a 'zero' cell returned from the dequeue, so every time you need to create new cells The Ykta. This will continue to increase the memory while scrolling for you, but be quite flat when inactive.

Edit:

Assume that your cell is ok, then you have to narrow it if it is video data or image data that is leaked Used to be. What is smallImage ? And do you really want to do everything only when the video is new?

  - (zero) set video: (video *) newVideo {if (new video! = Video) {[Video released]; Video = [keep new video]; NSDTA * imageData = [video.All images value fork: @ "thumbnail image"]; UIImage * uiImage = [[UIImage alloc] initWithData: imageData]; SmallImage.image = uiImage; NameLabel.text = video.displayName; [Ui Image release]; }}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -