DEV Community

Ben Halpern
Ben Halpern

Posted on

How much of a memory impact do tabs in my terminal have?

When I am running my dev server, the log lines add up quickly. It's largely stuff I don't care about unless it's what I'm currently dealing with, but it piles up.

Do the thousands upon thousands of lines that build up in the tabs I have open meaningfully impact the performance of my operating system? (In my case, MacOS)

I'd be curious to get a better sense of how this memory is managed and what does and does not hog resources in this regard.

Top comments (18)

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Back of the envelope:

5000 lines * average 100 unicode characters * average 2 bytes (probably most are ASCII 1 byte but whatever) ~= 1.000.000 bytes ~= 1MB

1MB * 25 tabs = 25MB.

Adblock Extension (when is idle) 300MB

I would say it is ok, your cognitive load on keeping that many terminals is way bigger then the technical load of them :D

Collapse
 
kip13 profile image
kip

That is another reason because I prefer uBlock

Collapse
 
bgadrian profile image
Adrian B.G.

Thanks, after a quick test it uses 60% less RAM and block with 10% more requests than AdBlockPlus.

The web got crazy, 82 blocked requests on wired.com and the website is still working ... and the Media > xkb option is crazy, never thought of that.

Thread Thread
 
kip13 profile image
kip

uBlock follow other rules in context about ads, check this is an awesome reading...

Thread Thread
 
jackharner profile image
Jack Harner πŸš€

Not sure if you have any control, but that link you linked's SSL Cert expired last week.

Thread Thread
 
kip13 profile image
kip

Yes I know but when I read the Cert was fine, maybe the owner didn't renew it

Collapse
 
adhocore profile image
Jitendra • Edited

isn't the OP about terminal tabs instead of browser tabs?

Collapse
 
bgadrian profile image
Adrian B.G.

Just pointing out that 25MB of ram is nothing nowdays πŸ˜€. And if he has dozens of terminal tabs imagine how many browser tabs he has open πŸ˜€

Thread Thread
 
jake profile image
Jake Casto

Me haha

Collapse
 
notriddle profile image
Michael "notriddle" Howell

Yes. The point is to have a basis for comparison.

Collapse
 
joehobot profile image
Joe Hobot • Edited

Activity Monitor should tell you info about it. (MacOS) yes each tab has its own process (Chrome: Helper). And yes if we are speaking about browser or terminal 'lines' those are all in buffer ram.. which you can set in preferences for iTerm for example.

alt

alt

Collapse
 
buinauskas profile image
Evaldas Buinauskas

Are you just curious or you actually notice something? I'm curious why you're curious. πŸ€”

Collapse
 
ben profile image
Ben Halpern

Processes like kernel_task are pretty opaque and take up a lot of memory sometimes. Terminal also has a pretty large impact occasionally but I'm not entirely sure how to ingest what is responsible for what. Finder can have a big impact, but I'm not always sure why.

Collapse
 
david_j_eddy profile image
David J Eddy

Agreed, why does finder eat up 25%+ CPU? Ever since I found htop many years back it has been my go-to for process monitoring.

Thread Thread
 
bgadrian profile image
Adrian B.G.

htop rocks, and do not forget to press H to group the threads.

Collapse
 
tadman profile image
Scott Tadman

Do you use anything like iStat Menus? It's a fantastic little toolbar application that can show you when things are spinning out of control, like you forgot you had a VM running, heavy disk I/O, or memory pressure.

Terminal is pretty low-key, but sometimes sub-processes of Terminal get lumped into the Terminal.app memory footprint in some visualizations. That means running a Docker VM can make it seem like Terminal is a huge hog.

The biggest pain is scroll-back buffers, but that's only a factor if you have them set to unlimited and are doing something like tail -f on a very busy log file.

Collapse
 
hoelzro profile image
Rob Hoelz

It depends on your terminal - most terminals can be configured to remove old lines from memory, which lowers the memory footprint. Also, I believe I read somewhere that some terminals can store their scrollback in files, which also lowers memory usage, but obviously has security implications if you're running sensitive commands.

As far actually memory usage goes, that also depends on the terminal - I have 10,000 lines of scrollback in urxvt, and filling that up increases my memory usage by about 16MB.

Collapse
 
val_baca profile image
Valentin Baca

The main factor is whether infinite scrollback enabled.

If you have finite scrollback, then your memory usage is going to be bounded; otherwise, no.