Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

fixOrientation memory #3001

@yardenhod

Description

@yardenhod

Bug Report

To Do First

  • [yes] Did you try latest release?
  • [no] Did you try master?
  • [yes] Did you look for existing matching issues?

Platforms

Android

Versions

  • Android: 10
  • iOS:
  • react-native-camera: 3.40.0
  • react-native: 0.61.5
  • react: 16.9.0
  • react-navigation: 5.12.3 (happens also in a clean project without any navigation)

Description/Current Behaviour

Expected Behaviour

When taking a picture with fixOrientation, memory is going up 100MB approximately and won't cleanup even after I navigate to another screen. Just after 5-10 minutes the garbage collector cleanup the memory.

Steps to Reproduce

Set fixOrientation to true in android device

Additionals

Code example: new project without navigation, just 1 screen.

class App extends React.Component {
  private _cameraRef;

  private _handleRef = ref => {
    this._cameraRef = ref;
  };

  private _takePicture = async () => {
    const image = await this._cameraRef.takePictureAsync({
      quality: this.CAMERA_QUALITY,
      fixOrientation: true,
      width: this.CAMERA_WIDTH,
      pauseAfterCapture: false,
      orientation: 'portrait',
    });

    RNFS.unlink(image.uri).catch(() => {});
  };

  render() {
    return (
        <View>
          <RNCamera
            style={{height: '100%', width: '100%'}}
            ref={this._handleRef}>
            <TouchableOpacity onPress={this._takePicture}>
              <Text>press here!</Text>
            </TouchableOpacity>
          </RNCamera>
        </View>
    );
  }
}

memory after taking a picture:
memory

memory after taking 4 pictures: If I take some more, the memory is still on 180MB
memory-after 3 more picture

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions