Skip to content

iOS Camera High Memory Usage #2374

Open
@ShoppasGit

Description

@ShoppasGit

Bug Report

When taking a photo or selecting images from gallery using the camera plugin. The memory usage jumps 70-100mb above normal memory usage.

Plugin(s)

"@capacitor/camera": "^7.0.1",

Capacitor Version

Latest Dependencies:

@capacitor/cli: 7.2.0
@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/ios: 7.2.0

Installed Dependencies:

@capacitor/core: 7.2.0
@capacitor/android: 7.2.0
@capacitor/cli: 7.2.0
@capacitor/ios: 7.2.0

Platform(s)

IOS

Current Behavior

Going into Camera to take a picture. Before camera usage app at 10mb memory usage. After taking a photo the memory jumps to 70-100mb. When selecting multiple images from the gallery (3 images) ram jumps 100-200mb and stays around 100mb after.

Expected Behavior

Memory may need to jump to convert the image however it looks like something is staying in the ram after.

Code Reproduction

async takePhoto() {
const image = await Camera.getPhoto({
quality: 90,
allowEditing: false,
resultType: CameraResultType.Uri,
source: CameraSource.Camera,
});

  const newPhoto: UserPhoto = {
    filepath: 'photo_' + new Date().getTime() + '.jpeg',
    webviewPath: image.webPath,
  };

  this.photos.unshift(newPhoto);
} catch (error) {
  console.error('Error taking photo:', error);
}

}

Watch memory usage in xcode.

Other Technical Details

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions