capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: Memory leak when calling native function repeatedly

Open vojto opened this issue 11 months ago • 1 comments

Capacitor Version

💊   Capacitor Doctor  💊

Latest Dependencies:

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

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 7.0.1
  @capacitor/core: 7.0.1
  @capacitor/ios: 7.0.1

[success] iOS looking great! 👌

Platforms Affected

  • [x] iOS
  • [ ] Android
  • [ ] Web

Current Behavior

  1. Create a simple plugin with promise-returning function.
  2. Implement it on iOS side - make it return a 10mb string
  3. Call this function multiple times from JS

If you run this on device, the Safari inspector will report memory being allocated for every call and never garbage collected.

Image

Expected Behavior

Memory should be garbage collected after each call.

Project Reproduction

https://github.com/vojto/dbtest

Additional Information

No response

vojto avatar Feb 11 '25 10:02 vojto

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar Feb 24 '25 18:02 ionitron-bot[bot]