You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an app in witch I show the PDFView inside a PageView.builder. This allows the user to swipe left and right between multiple documents. After swiping lots of documents, the app gets terminated because of too much memory consumption (iOS).
The memory view from the dart dev tools shows me that all the PDFView instances are still retained by their PDFViewController.
I have added a dispose method to the _PDFViewState that calls dispose on the controller and sets the reference to null. Inside the controller I added a dispose method that sets the methodCallHandler to null, the channel to null and the widget to null.
With these changes the PDFView does not get retained and disappears from the memory.
The text was updated successfully, but these errors were encountered:
I can confirm I'm also getting multiple PDFView instances and I did manage to get 0 instances with your solution @flbaue.
But now I'm facing a memory leak on iOS native classes:
@flbaue I think I've found a quick fix, not the ideal but it frees the memory.
Under the file FlutterPDFView.m inside the @implementation FLTPDFView add a new method:
I have an app in witch I show the PDFView inside a PageView.builder. This allows the user to swipe left and right between multiple documents. After swiping lots of documents, the app gets terminated because of too much memory consumption (iOS).
The memory view from the dart dev tools shows me that all the PDFView instances are still retained by their PDFViewController.
I have added a dispose method to the _PDFViewState that calls dispose on the controller and sets the reference to null. Inside the controller I added a dispose method that sets the methodCallHandler to null, the channel to null and the widget to null.
With these changes the PDFView does not get retained and disappears from the memory.
The text was updated successfully, but these errors were encountered: