Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Cache memory problem #53

Closed
wants to merge 1 commit into from

Conversation

illukinati
Copy link

Refer to #52
There is an error

* thread #13, name = 'io.flutter.1.io', stop reason = EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=1850 MB, unused=0x0)
    frame #0: 0x00000001f23c9138 libsystem_platform.dylib`_platform_memmove + 88
libsystem_platform.dylib`_platform_memmove:
->  0x1f23c9138 <+88>:  stnp   x8, x9, [x3]
    0x1f23c913c <+92>:  stnp   x10, x11, [x3, #0x10]
    0x1f23c9140 <+96>:  add    x3, x3, #0x20             ; =0x20 
    0x1f23c9144 <+100>: ldnp   x8, x9, [x1]
Target 0: (Runner) stopped.

I removed the line from 42 to 63 for deleting unused saved cache files.

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *temporaryDirectory = [paths objectAtIndex:0];
    NSString *filePathAndDirectory = [temporaryDirectory stringByAppendingPathComponent:kDirectory];
    NSError *error;

    // Clear cache folder
    if ([[NSFileManager defaultManager] fileExistsAtPath:filePathAndDirectory]) {
        NSLog(@"[FlutterPluginPDFViewer] Removing old documents cache");
        [[NSFileManager defaultManager] removeItemAtPath:filePathAndDirectory error:&error];
    }

    if (![[NSFileManager defaultManager] createDirectoryAtPath:filePathAndDirectory
                                   withIntermediateDirectories:YES
                                                    attributes:nil
                                                         error:&error])
    {
        NSLog(@"Create directory error: %@", error);
        return nil;
    }
    // Generate random file size for this document

    kFileName = [[NSUUID UUID] UUIDString];

It makes a memory problem when you try to open the PDF after several times.
There is no use to save the PDF caches from the getNumberOfPages method.

It makes memory problem when you try to open the PDF after several times.
@lohanidamodar
Copy link
Owner

merged with #94 as i was unable to edit this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants