Describe the bug
After adding flutter_cached_pdfview to my project and testing it, I observed "W/System ( 9662): A resource failed to call release." sporadically popping up in the Debugging-Console when I was scrolling through a PDF-Document.
To exclude some issues within my other project files, I created a new project with your example code and using a bigger PDF-File (I've used a Mainboard Manual from MSI with 9MB+ size). The issue was reproduceable after opening the PDF document, scrolling a bit, closing the pdf-view, opening again, scroll a bit, close it again.
Measured Memory with DevTools. I can't really say atm, if it really creates a memory leak, as the GC usually has several levels before finally releasing the allocated memory, but the message 'W/System ( 9662): A resource failed to call release.' seems to point to a memory leak after doing some research on Google.
To Reproduce
Steps to reproduce the behaviour:
Create a new Flutter project for Android. Change main.dart to the Example project for "flutter_cached_pdfview". Add a PDF file with size like 10MB or bigger to the project (best for observing the memory with DevTools).
Run the project, open the PDF file (doesn't matter if 'PDF From Url', 'Cashed PDF From Url' or 'PDF From Asset'), browse some pages forward and backward, close the view, open it again, etc. until you see 'W/System ( 9662): A resource failed to call release.' in the Console.
c:\src\flutter_cached_pdfview_mem_test>flutter run
Running "flutter pub get" in flutter_cached_pdfview_mem_test... 595ms
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Note: c:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_android-2.0.11\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Running Gradle task 'assembleDebug'... 19,6s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 763ms
Syncing files to device sdk gphone x86... 119ms
Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
Running with sound null safety
An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:52028/XXXXXXXXX=/
The Flutter DevTools debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:52028/XXXXXXXXX=/
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
W/Gralloc4( 9662): allocator 3.x is not supported
W/dfview_mem_tes( 9662): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (greylist, reflection, allowed)
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
E/BufferQueueProducer( 9662): [SurfaceTexture-0-9662-1](id:25be00000001,api:1,p:363,c:9662) queueBuffer: BufferQueue has been abandoned
E/BufferQueueProducer( 9662): [SurfaceTexture-0-9662-1](id:25be00000001,api:1,p:363,c:9662) cancelBuffer: BufferQueue has been abandoned
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
W/System ( 9662): A resource failed to call release.
I/chatty ( 9662): uid=10156(com.example.flutter_cached_pdfview_mem_test) FinalizerDaemon identical 4 lines
W/System ( 9662): A resource failed to call release.
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
W/System ( 9662): A resource failed to call release.
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
W/System ( 9662): A resource failed to call release.
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
W/System ( 9662): A resource failed to call release.
D/jniPdfium( 9662): Destroy FPDF library
D/com.shockwave.pdfium.PdfiumCore( 9662): Starting PdfiumAndroid 1.9.0
D/jniPdfium( 9662): Init FPDF library
W/System ( 9662): A resource failed to call release.
D/jniPdfium( 9662): Destroy FPDF library
Expected behaviour
Allocated memory for PDF view is released after closing the PDF view.
Screenshots
Before opening pdf view with PDF file of size around 9MB:
After some PDF view open - browse in document - close PDF view actions.
After closing the app:
These instances remain after pdf view is closed:
Desktop (please complete the following information):
OS: Windows 10 Pro
Browser: N/A
Version: N/A
Smartphone (please complete the following information):
Device: Android Emulator - Nexus 5X API 30
OS: Android 11.0
Version: API 30
Additional context
The issue also appears with your test pdf file from the example project, but it takes much longer to make the message 'W/System ( 9662): A resource failed to call release.' appear. Also when it happens once, it will occur most likely every time you repeat the reproduction steps.
Describe the bug After adding flutter_cached_pdfview to my project and testing it, I observed "W/System ( 9662): A resource failed to call release." sporadically popping up in the Debugging-Console when I was scrolling through a PDF-Document. To exclude some issues within my other project files, I created a new project with your example code and using a bigger PDF-File (I've used a Mainboard Manual from MSI with 9MB+ size). The issue was reproduceable after opening the PDF document, scrolling a bit, closing the pdf-view, opening again, scroll a bit, close it again.
Measured Memory with DevTools. I can't really say atm, if it really creates a memory leak, as the GC usually has several levels before finally releasing the allocated memory, but the message 'W/System ( 9662): A resource failed to call release.' seems to point to a memory leak after doing some research on Google.
To Reproduce Steps to reproduce the behaviour:
Create a new Flutter project for Android. Change main.dart to the Example project for "flutter_cached_pdfview". Add a PDF file with size like 10MB or bigger to the project (best for observing the memory with DevTools).
Run the project, open the PDF file (doesn't matter if 'PDF From Url', 'Cashed PDF From Url' or 'PDF From Asset'), browse some pages forward and backward, close the view, open it again, etc. until you see 'W/System ( 9662): A resource failed to call release.' in the Console.
Expected behaviour Allocated memory for PDF view is released after closing the PDF view.
Screenshots Before opening pdf view with PDF file of size around 9MB:![image](https://user-images.githubusercontent.com/29160339/152515143-c988f31d-d53c-4ce9-81fc-bacd9203c1fd.png)
After some PDF view open - browse in document - close PDF view actions.![image](https://user-images.githubusercontent.com/29160339/152515395-07dc9fac-2a2a-42e6-bffd-acaa667f8379.png)
After closing the app:![image](https://user-images.githubusercontent.com/29160339/152515475-8e592d65-ab50-45a2-97be-1f1b48a21d42.png)
These instances remain after pdf view is closed:![image](https://user-images.githubusercontent.com/29160339/152516097-31a03c92-4f23-4a67-9926-ca375d7b2c75.png)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context The issue also appears with your test pdf file from the example project, but it takes much longer to make the message 'W/System ( 9662): A resource failed to call release.' appear. Also when it happens once, it will occur most likely every time you repeat the reproduction steps.