ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

RAM memory problem

Open GeLi1989 opened this issue 1 year ago • 5 comments

I found that after using comfyui for a period of time ( like a week ), the program's RAM memory will continue to accumulate until it becomes too high, and finally the process will terminate.

Excuse me, is there a way to automatically release RAM memory when it reaches a certain level, or is there a way to prevent memory from accumulating continuously?

I have used “--normalvram” command and I know “--disable-smart-memory” My GPU is 3080,VRAM is 10GB MY RAM is 20GB

Is there any way to solve the problem?

Thanks!

GeLi1989 avatar Mar 13 '24 09:03 GeLi1989

I personally use --highvram --disable-smart-memory on an AMD R4750G APU (NVidia 3080 DGPU for you?) × 14.9GiB UMA × 43.7GiB main RAM

And on SDiffXL 6GiB UMA is the max low VRAM

9.31GiB UMA is still average in order to function ComfyUI of SDiffXL

petra-pannia avatar Mar 13 '24 14:03 petra-pannia

I only use SD1.5 model and animatediff model,not SDXL

GeLi1989 avatar Mar 13 '24 14:03 GeLi1989

I however instead start by SDiffXL base models but a few SDiff 1.5/1.6 waifues And i’m entirely unsure if AnimatedDiff could record 540p landscape 15:00m+ 25fps Diffused dramas with soundtracks and/or voices, which is still however an unlikely right now even for my AMD R4750G APU × (14.9+43.7)GiB RAM’s

petra-pannia avatar Mar 13 '24 15:03 petra-pannia

The issue is a memory leak issue in the pytorch build, it's resolved by using the pytorch nightly preview, but that can cause other issues. I did find that I didn't have a RAM buildup after that. Since then I have re-installed my machine and haven't yet installed pytorch nightly.

SilverAndJade avatar Aug 21 '24 21:08 SilverAndJade

The issue is a memory leak issue in the pytorch build, it's resolved by using the pytorch nightly preview, but that can cause other issues. I did find that I didn't have a RAM buildup after that. Since then I have re-installed my machine and haven't yet installed pytorch nightly.

I tried the nightly version, but the problem still exists.

pip3 install --pre --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124

huangqiaobo avatar Aug 28 '24 12:08 huangqiaobo

Anyone could find a solution or the cause of the problem?

I am having the same problem, accumulating RAM usage between image generations. I have tried using the nightly version of pytorch and the switches --highvram --disable-smart-memory but no dice.

SimonBlancoE avatar Oct 31 '24 18:10 SimonBlancoE

So my main solution ended up being to increase the swap file on my disk. It was automatically set to 2GB so I increased it to 8GB, which prevents my PC from freezing up completely.

SilverAndJade avatar Oct 31 '24 19:10 SilverAndJade