Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in sd-auto:68 #612

Closed
2 tasks done
DevilaN opened this issue Nov 14, 2023 · 6 comments · Fixed by #620
Closed
2 tasks done

Memory leak in sd-auto:68 #612

DevilaN opened this issue Nov 14, 2023 · 6 comments · Fixed by #620
Labels
bug Something isn't working

Comments

@DevilaN
Copy link
Contributor

DevilaN commented Nov 14, 2023

Has this issue been opened before?

  • It is not in the FAQ, I checked.
  • It is not in the issues, I searched.

Describe the bug

Tried to run app and my RAM usage exploded slowly. I can generate few images 512x78 and each time after generated image is converted from latent space to pixel space RAM usage grows about 1.5GB+ until after few images generated it gets OOMKilled.
There was no such issue with sd-auto:67 image.

Which UI

auto

Anyone observing same problems?

@DevilaN DevilaN added the bug Something isn't working label Nov 14, 2023
@AbdBarho
Copy link
Owner

@Snowflec
Copy link

Snowflec commented Nov 18, 2023

Oof, I think I know what's the problem

Are there any temporary fixes that can be made or a way to rollback to a previous version until this is fixed?

@DevilaN
Copy link
Contributor Author

DevilaN commented Nov 22, 2023

Bump. I would like to see some advice on how to fix this problem here if @AbdBarho can point out what is the main cause of memory leak. Diff from commit tells me nothing. There are many changes there.

@NarinderS
Copy link

NarinderS commented Nov 29, 2023

The diff that AbdBarho linked highlights what you need to add, specifically these two lines to services/AUTOMATIC1111/Dockerfile:

RUN apt-get -y install libgoogle-perftools-dev && apt-get clean
ENV LD_PRELOAD=libtcmalloc.so

I added them around line 29, after the apt-install steps.

@DevilaN
Copy link
Contributor Author

DevilaN commented Nov 30, 2023

@NarinderS you are my hero today :)
Instead of changing Dockerfile and rebuilding image I suggest to add in ./data/config/auto/startup.sh:

# RAM LEAK FIX: https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/326#issuecomment-1435698896
# Stubborn pest came back: https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/612#issuecomment-1831120187
if [[ ! -L "/usr/lib/x86_64-linux-gnu/libtcmalloc.so" ]]; then
  apt-get update && apt-get -y install libgoogle-perftools-dev && apt-get clean
fi
export LD_PRELOAD=libtcmalloc.so

AbdBarho added a commit that referenced this issue Jan 1, 2024
Fixes
#612

---------

Co-authored-by: AbdBarho <ka70911@gmail.com>
@AbdBarho
Copy link
Owner

AbdBarho commented Jan 1, 2024

Should be fixed now, sorry for being late, happy new year!

yarmand pushed a commit to yarmand/stable-diffusion-webui-docker that referenced this issue Feb 15, 2024
Fixes
AbdBarho#612

---------

Co-authored-by: AbdBarho <ka70911@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants