Skip to content

fix: call GC upon image picking #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/imagepicker.ios.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as data_observable from "tns-core-modules/data/observable";
import * as frame from "tns-core-modules/ui/frame";
import * as imageAssetModule from "tns-core-modules/image-asset";
import { Options, ImagePickerMediaType } from ".";
import { View } from "tns-core-modules/ui/core/view/view";
import * as utils from "tns-core-modules/utils/utils";

const defaultAssetCollectionSubtypes: NSArray<any> = NSArray.arrayWithArray(<any>[
PHAssetCollectionSubtype.SmartAlbumRecentlyAdded,
Expand Down Expand Up @@ -102,7 +102,13 @@ export class ImagePickerControllerDelegate extends NSObject implements QBImagePi

this._resolve(assets);

imagePickerController.dismissViewControllerAnimatedCompletion(true, null);
imagePickerController.dismissViewControllerAnimatedCompletion(true, () => {
// FIX: possible memory issue when picking images many times.
// Not the best solution, but the only one working for now
// https://github.com/NativeScript/nativescript-imagepicker/issues/222
setTimeout(utils.GC, 200);
});

}

public static ObjCProtocols = [QBImagePickerControllerDelegate];
Expand Down