Home > Blockchain >  The Nuxt.js (SPA) application crashes when I keep taking photos in iOS Safari. (Caused by a memory l
The Nuxt.js (SPA) application crashes when I keep taking photos in iOS Safari. (Caused by a memory l

Time:11-24

I have created an application that uses Nuxt.js (SPA) to take up to 20 images taken with the iPhone and register all 20 at once. When the images are taken, they are compressed to about 500KB using a library called browser-image-compression and retained. The compressed images are then displayed in a preview.

The problem is that when registering 20 photos multiple times, the Nuxt.js application suddenly crashes in the middle of the process (when taking a photo, the captured image suddenly starts to disappear after loading, like when reloading).

Thinking it could be a memory leak, I tried measuring it on the Mac Safari timeline, but the memory usage goes up and up with each shot, and does not go down.

I tried to refresh memory with location.reload(true), but the memory usage did not go down.

Please let me know the solution to refresh the memory, or anything that will stop the application from crashing.

Memory Timeline just before the crash

Versions

  • iPhone 11
  • iOS 14.6
  • @nuxt/cli v2.14.12
  • Vue v2.6.14
  • browser-image-compression v1.0.14

CodePudding user response:

There is a PR about this which aimed to fixed this exact bug. It maybe didn't fixed it really.

Please try to double-check the actual memory usage in another browser like Chrome or Firefox and see if it does the same. If it didn't, it's maybe time to give some feedback to browser-image-compression or use another package.

  • Related