Atom uses large amounts of memory


#1

In the task manager Atom uses 4.4Gb RAM. I have opened a folder with a single .md file in it (about 800 lines). While editing the RAM usage increases fast. Even while using the save mode. I am also not using the markdown preview. I started the developer mode and ran a performance record. It shows a js heap of about 2Gb.
What further steps should I take?
Any help is appreciated!

EDIT:
I left it minimized in the taskbar and its now using 5.2Gb of RAM.


#2

Does the lower right-hand corner of the window have the word Git followed by an absurdly large number?

If so, then you have a git repo in a folder above the one you’re currently in (it might be your user folder or your desktop; you haven’t given us much information to go on) and you should delete the .git/ folder there. It probably wound up there by accident, and is a problem that happens from time to time that’s almost undetectable except that it causes Atom to freak out. The cause of the problem is that the high-level folder doesn’t contain a .gitignore file and Atom is trying to read every single file in that tree to try to help you manage your repo.

If that’s not the case, I’m out of ideas.


#3

Thanks for your reply. Git (1) is being displayed. Regarding “you haven’t given us much information to go on”: I will happily provide any additional infos. (I would have provided them if I knew what I should provide)
I just rebootet my Laptop maybe its all working fine now. (Although I have already restarted it multiple times before)
Please tell me how much RAM it normally uses.


#4

The one window I have open uses about 900 megabytes of RAM spread over a handful of processes, with the biggest one being just under 600. I’ve had that window open for days and used it off and on.


#5

Thanks for that information. I will reply in a few hours when I am using Atom again.


#6


Its still increasing fast. JS heap is much lower than the used RAM (still big though).
There is some timer ticking in the background that takes about 1ms to execute.
I ran a profile but I don’t know how to track down what is causing the timer.
I think this timer is causing the problem:

Can someone tell me how to find out what plugin is causing it or if atom itself is causing it.


#7

You said you saw it in safe mode, so there’s not much I can suggest.

To find the cause though, open in safe mode and try disabling the git-diff and maybe github packages. They’re the most common cause of issues, and it will scale with the repo size.

* assuming this is in a git repo. Disregard otherwise.


#8

How many lines are in that markdown file?


#9

About a thousand. (But it happens when the live preview is turned off. [EDIT: I think I will test that to make sure) It doesn’t happen when I edit html with preview and other plugins. I think its markdown related.


#10

A thousand lines isn’t much and shouldn’t be causing this.

We’ve checked all of the places I can think of. Tagging @rsese in case he has any more insight.


#11


I got a picture of it happening while use safe mode. I will try to reproduce it without the preview and without git though that will take some time (Sad that I have to work with reduced features for some time to figure out what’s causing the memory leak).
Wow this time it reached nearly 7 Gb. At 4 Gb the editor starts to lag a bit.

EDIT:
I disabled all markdown related plugins and all git related plugins and the memory leak is gone. Now I just have to find out which of the standard plugins is causing the leak.

PS: I really appreciate the help I got so far.


#12

Hmm, it seems like the usual suspects were checked and weren’t related (safe mode, .git\ folder in your home directory, etc.).

I disabled all markdown related plugins and all git related plugins and the memory leak is gone. Now I just have to find out which of the standard plugins is causing the leak.

So you disabled core packages and now can no longer reproduce? That is interesting and it sounds like you’re going to re-enable one-by-one to see if you can pinpoint which one might be causing the problem?

A few other questions:

  • What version of Atom are you running?
  • Have you worked on this same project in previous versions of Atom with no problem?
  • Can you share the project with us (if not because it’s private that’s totally fine of course) so we can try to reproduce with it?

#13

I am running:
1.34.0 x64
This project has been causing the problems right from the start. I created the project recently, so I only used the version stated above.
The project is not really secret (1000 lines) but I don’t want to give it any open source license. I am willing to share it as long as you don’t use it in any other way than investigating the problem its causing with atom.

Additional information:
I am using a selfhosted gitlab instance. It might be possible that the git plugin can’t handle that properly. Although it works fine with other projects.
I could also be related to me closing my laptop and opening it again.

The problems:
Its not easy to isolate the problem as it happens overtime it takes about 10-40min to build up enough RAM usage to tell its a leak and not just a peak. :grin:

Is it enough to just disable the packages or do I have to run shift-ctrl-f5?


#14

Many packages do not disable cleanly, so restarting Atom is the safest way to confirm they’ve been disabled properly.


#15

Capture
Is git completely disabled?
I will move the file out of the git repo and try to reproduce it again.


#16

No, that yellow count is provided by the git-diff package. I believe disabling that as well will disable all git behaviour, but the cleanest way to test is to not use a git project like you say.


#17

I moved the file out of the git repo and edited it there while all git-plugins were disabled and atom was in safe mode - it happened again. So I think the git plugins aren’t the reason for the leak. I will disable the markdown plugin next to make sure it’s not causing the leak.
It’s really though to find out what’s causing it as the leak takes time to be noticeable.
Thanks for your participation in this conversation. I am confident that I will be able to identify (and fix) the problem with your help.


#18

This post was flagged by the community and is temporarily hidden.


#19

Todays results:
I disabled nearly everything and moved the file out of the git repo. I started editing and even after hours the memory stayed by about 300Mb. Then I enabled the markdown preview (the core one) and restarted. (Again into safe mode) After some time the memory started to increase again.
Steps to reproduce:

  • Open any md file.
  • Press enter several times
  • Place a cursor in every empty line (using ctrl-mouse)
  • Write #[space]asdf[enter] (I don’t know if headings are the only reason but they seem to cause a fast memory increase)
  • Repeat the last step while watching the RAM using the task manager
  • The memory increases fast
  • After it reached about 2Gb or more delete everything you wrote
  • Even if you don’t do anything the memory won’t be freed again

Please try the above and tell me if you could reproduce it. Thanks!

Although I not sure I that’s the problem as it doesn’t really increase beyond 2Gb and the real issue (when I enable all core plugins) is the increase although I don’t do anything.


#20

Thanks for the repro steps, I’ll give this a try on a Windows machine soon.