2017-03-06 1 views
0

나는 메모리 누설 메모리 빠른 3

다음

을 증가 테이블 뷰 didSelectRow 방법에서 식별자 i는 셀을 탭마다 SEGUE 수행 갖는 문제 내 코드가주세요

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
    // firstly i need to check if edit button is true so i can select cell 
    if isShowToolBar { 
     // her for hold selected index 
     let cell = tableView.cellForRow(at: indexPath) as? MovieDownloadedTableViewCell 
     if let cell = cell { 
     cell.movieCheckMarkImageView.isHidden = false 
     cell.movieEmptyCircleImageView.isHidden = true 
     operationDocumentDirectoryObject.dictionaryHoldIndexCellForDisplayWhichCellSelected.updateValue(indexPath.row, forKey: indexPath.row) 
     // start hold URL 
     operationDocumentDirectoryObject.dictionaryForHoldURLSelected.updateValue(operationDocumentDirectoryObject.arrayOfMovieURL![indexPath.row], forKey: indexPath.row) 
     }// end the if let cell 

    }else{ 
     // her for show the content folder 
     let cell = tableView.cellForRow(at: indexPath) as? MovieDownloadedTableViewCell 
     if let cell = cell { 
      if cell.fetchURL!.pathExtension == "" { 
       performSegue(withIdentifier: "ShowFolder", sender: indexPath.row) 
      }else{ 

      // playing the video 
     performSegue(withIdentifier: "PlayingMovie", sender: cell.fetchURL!.lastPathComponent) 

      }// end the if for check path extenstion 
     }// end the if let cell 
     cell = nil 

    }// end the if for the isShowToolbar 

} 

상기 방법은 (cell.fetchURL! .pathExtension == ''경우) 또한 메모리

누수 확인 메모리 누수에 SEGUE을 수행하고 와 메모리를 증가시키는 원인이
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    if segue.identifier == "MoveFile" { 
     if let destination = segue.destination as? MoveMovieViewController { 
      destination.operationDocumentDirectoryObject.dictionaryForHoldURLSelected = self.operationDocumentDirectoryObject.dictionaryForHoldURLSelected 
     } 

    }else if segue.identifier == "ShowFolder" { 
     if let destination = segue.destination as? ShowContentFolderMovieViewController { 
      if let fetchIndex = sender as? Int { 
       destination.operationDocumentDirectory.folderName = self.operationDocumentDirectoryObject.arrayOfMovieURL![fetchIndex].lastPathComponent 
      } 
     } 
    }else if segue.identifier == "PlayingMovie" { 
     // make an object for the playing video view controller 
     if let destination = segue.destination as? PlayingMovieViewController { 
      if let movieName = sender as? String { 
       destination.operationDocumentDirectory.movieName = movieName 
      } 

     } 
    }// end the condition for the segue 
} 

deinit 뷰 컨트롤러에서 호출 성공하지만 난 여전히 메모리 누수 및 증가하고 있지만

내 잘못된 코드입니다 무엇을 도와주세요?

는 당신에게 당신이 코드에서 어딘가에 강한 참조주기가 의심

답변

0

대단히 감사합니다 - 아니 당신이 지금까지 내가 말할 수있는 게시 한 비트에, 비록. 그러나, 귀하의 deinit가 성공적으로 호출되고 있다고합니다. 당신이 기대하는 시점에 (예 : PlayingMovieViewController 또는 ShowContentFolderMovieViewController를 해고 할 때) 세그 링하고있는 모든 뷰 컨트롤러의 시점이 호출되는지 확인 했습니까? xcode 디버그 콘솔에서 메모리 내 적절한 릴리스를 확인하기 위해 인쇄 명령문을 제거하는 것이 가장 좋은 방법입니다. 귀하의 메모리 누수가 어딘가에서 올 수 있습니다. 코드의 다른 곳에서 강력한 참조를 찾아야합니다 (발신자 객체를 보유한 대리자 일 수도 있습니다).

+0

그런 의미에서 내 segue가 옳았는데 다른 메소드를 검색해야합니까? 내가 악기 도구를 사용할 때 그것은 4.45 mib 걸리는 수행 segue를 가리키는 것입니다. 왜 그런지 모를 것입니다. 나는 모든 시각을 deinit에서 해제해야합니까? – Mustafa

+0

뷰 컨트롤러의 모든 deinit 메서드는 성공적으로 호출됩니다.하지만 인스트루먼트 도구에서 확인하면 성능이 나빠집니다 4.45 mb를 사용하는 식별자로 performSegue – Mustafa

+0

인스트루먼트 도구의 스크린 샷을 게시 할 수 있습니까? 너를 보여주는거야? – hvasam