Warp icon indicating copy to clipboard operation
Warp copied to clipboard

Memory leak?

Open selkordy opened this issue 1 year ago • 3 comments

Dupe Check

Describe the bug

Warp is using 100gb memory on my Mac. No doubt I've got a few tabs open but I only have a few remote SSH sessions going. It's leaking somewhere.

To reproduce

Not sure, but I've got ~8 tabs open with maybe ~15 panes

from top ID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP PPID STATE 527 stable 5.3 04:09:56 73 3 461 101G+ 512M 76G- 527 1 sleeping

Expected behavior

No response

Screenshots

No response

Operating system

MacOS

Operating system and version

Sonoma 14.6.1 (23G93)

Shell Version

No response

Current Warp version

v0.2024.09.24.08.02.stable_01

Regression

Yes, this bug started recently or with an X Warp version

Recent working Warp date

Not sure, but I would have noticed a process using 100gb of memory. I believe this was introduced in the latest release.

Additional context

As of last week I did receive a few popups from my Mac that I was low on mem, but checking top nothing was using an excessive amount of memory and showed plenty of free memory available. I also received OOM errors in other apps. I now believe Warp has a memory leak.

Does this block you from using Warp daily?

No

Is this an issue only in Warp?

Yes, I confirmed that this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

selkordy avatar Oct 03 '24 23:10 selkordy

Hey @selkordy - thanks for letting us know! Definitely something very wrong here.

I assume you've restarted Warp since then? If so, have you experienced runaway memory usage again?

vorporeal avatar Oct 09 '24 16:10 vorporeal

Yes I've restarted since and haven't seen such excessive memory usage.

I have a hunch the problem is related to tqdm. I had many tqdms going with leave=False running a process that took days to run accumulating memory.

selkordy avatar Oct 09 '24 17:10 selkordy

Same here. 60GB memory usage on Mac Two tabs. Two panes on one tab.

It builds up when you leave it open. I've been using it daily for a couple weeks. So I usually just restart it periodically.

stanleyume avatar Oct 10 '24 11:10 stanleyume

Any news on this? I'm also having the same issue. Swap seems to be almost full too. Last screenshot was taken during a cmd + q on the app. Looks like memory is being freed up in real time.

Screenshot 2024-12-02 at 14 12 15 Screenshot 2024-12-02 at 14 07 17 Screenshot 2024-12-02 at 14 13 57

Edit: swap definitely went down after quitting Warp.

Screenshot 2024-12-02 at 14 17 14

demyxco avatar Dec 02 '24 22:12 demyxco

Hey all - we discovered recently that the macOS Activity Monitor will attribute memory usage of all processes that are descendants of Warp to the Warp app. (In general, it prefers to provide resource consumption metrics at an "app" level, not a process level.)

This means that if you're running a process in your shell (a tool or a program you're developing) that gobbles up memory, the Activity Monitor will show that as Warp using up a ton of memory.

When this next happens, can you take a look at a process monitoring tool (e.g.: top/htop/btop) and see what the resident set size of the warp process is? Would be good to know if Warp is consuming memory or it's actually some other process.

(Someone on our team ran into this issue, and it turned out that the golangci-lint process they were running in a shell session was using 30GB of RAM, and Warp was actually only using 500MB.)

vorporeal avatar Dec 04 '24 17:12 vorporeal

@vorporeal it happened again. I'm a sysadmin so I'm mainly using warp to ssh into several servers at any given time and usually leave it open. I don't have anything using tail or executing a binary that constantly streams to stdout so I'm not understanding what is causing this memory leak. Screenshot 2024-12-05 at 10 42 11 Screenshot 2024-12-05 at 10 44 49 Screenshot 2024-12-05 at 10 45 58

demyxco avatar Dec 05 '24 18:12 demyxco

Yeah, so "Real Memory Size" ("RES", in the htop image) is the thing that's most relevant here - Warp is only actually using 427MB of physical memory. "Virtual Memory Size" represents how much memory is mapped in the virtual memory subsystem, but that also includes things like empty/zero pages, which don't actually map to any real/physical memory.

In the tree of processes under the stable --sever process (pid 63105), are there any with a large value in the "RES" column (i.e.: anything in the multiple gigabytes range)?

vorporeal avatar Dec 05 '24 18:12 vorporeal

I didn't think you'd reply so fast but unfortunately I already relaunched the app. I'll check when/if it happens again. You guys have any idea what's going on or a fix on the way?

demyxco avatar Dec 05 '24 18:12 demyxco

My best understanding at the moment is it's an attribution issue - Activity Monitor is attributing the memory consumption of a descendant process to Warp.app, but Warp itself isn't responsible for that memory usage.

vorporeal avatar Dec 05 '24 19:12 vorporeal

With recent releases, currently on v0.2025.05.28.08.11.stable_03, I've noticed an issue with memory bloat / leak. With Warp sitting launched in the background with no windows or tabs open most of the time. Looking at Activity monitory, the actual Warp process doesn't look to bad, but I see two processes named 'stable'. One that reports Memory: 850 MB and VM Compressed of 760 MB. The other Memory: 2.35 GB and VM Compressed pf 2.15 GB. I first started looking into memory usage after seeing bloated swap usage (by looking at iStat Menus)

sleifer avatar Jun 03 '25 23:06 sleifer

I encountered a similar issue on my Ubuntu 22 PC. I found that after connecting to a Docker container, even without doing anything, Warp's memory usage increases by 2MB per second and never stops. If I disconnect from the Docker container, the memory usage stops increasing. However, the memory that has already been consumed is not released, even after I close the tab.

falrom avatar Jul 11 '25 03:07 falrom

I encountered a similar issue on my Ubuntu 22 PC. I found that after connecting to a Docker container, even without doing anything, Warp's memory usage increases by 2MB per second and never stops. If I disconnect from the Docker container, the memory usage stops increasing. However, the memory that has already been consumed is not released, even after I close the tab.

I did some more testing. Simply attaching to an already running Docker container does not, by itself, cause a memory leak. However, once I execute the command 'Warpify subshell Ctrl+I', memory usage begins to grow endlessly.

falrom avatar Jul 21 '25 08:07 falrom

@falrom I can reproduce this - thanks for the detailed report! I'll take a look today and see if I can get a fix into this week's release.

vorporeal avatar Jul 21 '25 17:07 vorporeal

same here. macos started frqly pop me to quit app freeup ram i saw warp is 9gb ram everi time. wild is in the activity monitor just show 300mb. i dont know whats happen but something

happyf-weallareeuropean avatar Jul 22 '25 07:07 happyf-weallareeuropean

same here. macos started frqly pop me to quit app freeup ram i saw warp is 9gb ram everi time. wild is in the activity monitor just show 300mb. i dont know whats happen but something

i run a small 30mb backend server 24/7 with logs 1 tab in warp.

happyf-weallareeuropean avatar Jul 22 '25 07:07 happyf-weallareeuropean

@happyf-weallareeuropean In the macOS dialog to "free up application memory", my understanding is that it aggregates memory usage up to the application level. This means that, if you're running a program inside Warp that uses a lot of memory, the dialog will claim that Warp is using that memory.

I'm guessing what's happening here is that your server is actually using a ton of memory? Can you take a look at Activity Monitor to see if that's true?

vorporeal avatar Jul 22 '25 16:07 vorporeal

I have the issue all the time. I don't know if having 3 warp processes running makes it worse but it happens all the time.

clintonm9 avatar Jul 29 '25 18:07 clintonm9

I use both Windows and macOS machines, but the issue is more severe on Windows.

Even after closing all but one tab, the memory usage doesn't decrease. Image

Image Image

zh-impact avatar Aug 04 '25 18:08 zh-impact

@falrom I can reproduce this - thanks for the detailed report! I'll take a look today and see if I can get a fix into this week's release.

Forgot to follow up here at the time - this has been live for ~two weeks now.


Want to acknowledge the couple additional comments above. I'm trying to come up with ideas for how we can better diagnose what's going on here; will follow up when I have more updates.

vorporeal avatar Aug 04 '25 18:08 vorporeal

Same problem here on different macs, sometimes warp uses over 100gb memory.

Openliquid avatar Sep 16 '25 11:09 Openliquid

I can confirm this happens with windows again on the version from a week or two ago. It sometimes balloons over 40-50gb of RAM. The issue seems to amplify if I have warpified shells open. When it gets to around 50gb it becomes very sluggish inside those sessions, which is only fixed by restart of the program.

ToBeCode avatar Sep 27 '25 16:09 ToBeCode