Skip to content

Immich is running out of memory while creating thumbnails (runaway memory) #22515

Closed

Description

@parth017

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

While attempting to generate thumbnails for approximately 45,000 images stored on the server, the immich server repeatedly encounters memory shortages and restarts with the same issue again and again. Seems like the garbage collection is not working in the jobs as it should so memory usage keeps increasing until hitting max.

Image

The OS that Immich Server is running on

Debian 12

Version of Immich Server

v1.144.1

Version of Immich Mobile App

v1.144.1

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

No response

Your docker-compose.yml content

not relevant, same as docker-compose from repo

Your .env content

not relevant

Reproduction steps

  1. With bigger library, go to Jobs
  2. Generate Thumbnails jobs >> All
  3. Observer the server memory usage and restart behavior.

Relevant log output

Additional information

No response

Activity

  1. droopanu commented on Sep 30, 2025

    @droopanu

    Hello,

    I have noticed the same issue since upgrading to 1.144.1.

    I upgraded around 10.20, and look at the memory hog afterwards

    Image Image

    Currently the only jobs running are the the face detection and facial recognition:

    Image
  2. mertalev commented on Oct 1, 2025

    @mertalev
    Member

    Hi, which release did you upgrade from?

  3. droopanu commented on Oct 1, 2025

    @droopanu

    @mertalev from 1.143.1

    I can confirm @parth017 assessment that this seems to be caused by Thumbnail Generation.

    In my case it seems that facial recognition triggers a regeneration of the thumbnails and that causes the memory leak.
    As soon as I pause the thumbnail generation job, the memory leak stops.

  4. parth017 commented on Oct 1, 2025

    @parth017
    Author

    Hi, which release did you upgrade from?

    upgraded from v1.143.1

  5. mertalev commented on Oct 1, 2025

    @mertalev
    Member

    It seems that Trixie uses a buggy alpha release of libmimalloc, which has relevant bug fixes relating to freeing memory in its changelog since the 3.0.1 alpha. We can comment out the LD_PRELOAD line in the start script until that's resolved.

  6. parth017 commented on Oct 1, 2025

    @parth017
    Author

    can we not revert this to use v2 meanwhile?

    38226fd

  7. mertalev commented on Oct 1, 2025

    @mertalev
    Member

    Setting that to 2 is no different than commenting it out. It just doesn't use libmimalloc in either case.

  8. parth017 commented on Oct 1, 2025

    @parth017
    Author

    Setting that to 2 is no different than commenting it out. It just doesn't use libmimalloc in either case.

    Got it

  9. G36maid commented on Oct 1, 2025

    @G36maid

    Same problem here.

    While attempting to generate thumbnails for approximately 180,000 images,
    immich-server keeps consuming all my memory, eventually hitting OOM and restarting the container.

    I'm deploying via Docker Compose on Arch rolling (kernel 6.12.49-1-lts), Immich v1.144.1.

    Temporary workaround: I've limited the Docker memory to prevent impacting other services,
    but the container still keeps restarting during thumbnail generation.

    When limit to 6GB on 8GB VMs (Red is immich-server):
    Image

  10. moved this from To triage to Done in Issue Trackeron Oct 1, 2025
  11. maxi1134 commented on Feb 14, 2026

    @maxi1134
    Image Image

    This issue still seems present on v2.5.6

    Image

    My instance causes its VM to crash daily, even tho it has 60GB allocated

  12. maxi1134 commented on Mar 5, 2026

    @maxi1134
    Image

    This is still an issue

  13. mertalev commented on Mar 7, 2026

    @mertalev
    Member

    @maxi1134 Can you try setting LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libmimalloc.so.3" (replace x86_64 with aarch64 if you're on arm64)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions