immich icon indicating copy to clipboard operation
immich copied to clipboard

fix(mobile): Fixes memory image cache for local images

Open martyfuhry opened this issue 10 months ago • 4 comments

  • Reduces number of "large" decoded images in memory from 100 down to 12. I was unable to reproduce the out-of-memory errors with this number of "large" images in the image cache and the performance was acceptable.
  • Changes on device file cache from using a ImageCacheManager to a more generic CacheManager because we don't need the additional complexity of image decoding in the cache.

martyfuhry avatar Apr 22 '24 13:04 martyfuhry

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: d40d2a2
Status: ✅  Deploy successful!
Preview URL: https://4d46105e.immich.pages.dev
Branch Preview URL: https://fix-mobile-image-cache-memor.immich.pages.dev

View logs

The old version may have been working, honestly:

image

This is a fine rewrite of the complicated logic from before, but I don't think it's fixed the issue. I will keep this in draft until I find something more.

martyfuhry avatar Apr 22 '24 13:04 martyfuhry

Thanks for this PR! It's better now, system (Samsung S20FE) still kills other apps, but Immich luckily survives.

waclaw66 avatar Apr 23 '24 05:04 waclaw66

Thanks for this PR! It's better now, system (Samsung S20FE) still kills other apps, but Immich luckily survives.

I think this is expected system behavior; high memory apps in the foreground are allowed to cause the system to close other apps. If this is unexpected, I'd be happy to look through some "best practices" or something from the app developer (Android / iOS) docs and see what types of things they recommend. There is still likely a memory leak, but I think this addresses the 99% case.

martyfuhry avatar Apr 23 '24 13:04 martyfuhry