Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

iOS Extremely Large Memory Usage #21

@NatanijelVasic

Description

@NatanijelVasic

Hello :)

Great plugin! I am using the resize function as described here for iOS and Android: (https://discourse.nativescript.org/t/how-can-i-resize-images/1336)

I noticed that I get a very large memory consumption during the resizing process, especially on iOS (I'm running iOS 12), as shown here: https://ibb.co/esx7rL

Am I doing something wrong?

function resizeAndEncodeImage(image){

    utilsModule.GC();

    console.log("resize start");

    var base64JPEG;
    var mutable = BitmapFactory.makeMutable(image);
    var bmp = BitmapFactory.create(image.width, image.height);

    console.log("resize 1");
    
    bmp.dispose(function(b) {

        b.insert(mutable);

        var b2; 

        if(application.ios){
            if(image.ios.scale == null){
                b2 = b.resizeHeight(compressedImageHeight);
            } else{
                b2 = b.resizeHeight(compressedImageHeight/(image.ios.scale));
            }
        }

        if(application.android){
            if(image.android.scale == null){
                b2 = b.resizeHeight(compressedImageHeight);
            } else{
                b2 = b.resizeHeight(compressedImageHeight/(image.android.scale));
            }
        }

        base64JPEG = b2.toBase64(BitmapFactory.OutputFormat.JPEG, 60); 

        b.dispose(function(){});
        b2.dispose(function(){});

    });

    utilsModule.GC();

    return base64JPEG;

}

Thanks so much for the help!!
Natanijel Vasic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions