LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-26-2024, 04:15 PM   #1
j12i
Member
 
Registered: Nov 2013
Location: UTC+1
Distribution: Slackware64 15.0
Posts: 160

Rep: Reputation: Disabled
emacs leaks memory after upgrade to 29.3


Hi,
after the latest upgrade of Emacs in Slackware64 15.0, some stuff was broken so I did M-x package-upgrade-all, and after that everything seemed to work just fine. But today I noticed my system becoming slow whenever I ran emacs, and sure, it takes a full virtual CPU core (shows at 12.3% CPU untilisation) and eats RAM like there's no tomorrow. I've seen it stop growing at 5.5 GB or even go up above 8.

Is there a way to debug this, see what inside emacs is doing this?
 
Old 03-26-2024, 04:33 PM   #2
j12i
Member
 
Registered: Nov 2013
Location: UTC+1
Distribution: Slackware64 15.0
Posts: 160

Original Poster
Rep: Reputation: Disabled
When started with -Q, so no customizations whatsoever, RAM utilisation rises slower, but the constant CPU utilisation still happens.
 
Old 03-27-2024, 08:06 AM   #3
j12i
Member
 
Registered: Nov 2013
Location: UTC+1
Distribution: Slackware64 15.0
Posts: 160

Original Poster
Rep: Reputation: Disabled
went back to the old version for now.
emacs-27.2-x86_64-2_slack15.0.txz from https://slackware.uk/cumulative/slac...ches/packages/
 
Old 03-27-2024, 09:42 PM   #4
thirdm
Member
 
Registered: May 2013
Location: Massachusetts
Distribution: Slackware, NetBSD, Debian, 9front
Posts: 317

Rep: Reputation: Disabled
I'm not seeing this so far. Haven't loaded a whole bunch of files, but with eww visiting slackware.com, a small common lisp file, and slime running, this is my memory usage:

Code:
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
XXXXXX   16175  1.4  4.0 805388 158012 ?       Ssl  21:28   0:56 emacs --daemon
I figure we should more or less ignore VSZ for something like this. Isn't it common in lisp programs to allocate a huge block of memory up front? Doesn't mean it's ever actually used, and it being Linux it's not taken from anything else just be allocation. The RSS is pretty big compared to what I remember, certainly big next to perl 5, but if anything it seems to be zippier, though that could be subjective.

I was pretty happy to get this update in 15.0, so I hope the memory leak you see isn't universal. I feel like my operating system has gotten a major upgrade, like an early birthday present, more so than I would with a new kernel or glibc, and I don't use a window manager that changes with upgrades. It's so cool how Slackware will upgrade instead of patch when it makes sense to.
 
1 members found this post helpful.
Old 03-28-2024, 02:03 AM   #5
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 959

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by thirdm View Post
I feel like my operating system has gotten a major upgrade, like an early birthday present, more so than I would with a new kernel or glibc, and I don't use a window manager that changes with upgrades. It's so cool how Slackware will upgrade instead of patch when it makes sense to.
The emacs upgrade was really a security patch against CVE-2022-45939.
It might be OK to stick with older versions of emacs as long as ctags is not used in directories with untrusted contents.

regards Henrik
 
1 members found this post helpful.
Old 03-28-2024, 06:56 AM   #6
j12i
Member
 
Registered: Nov 2013
Location: UTC+1
Distribution: Slackware64 15.0
Posts: 160

Original Poster
Rep: Reputation: Disabled
I should add that I run a Wayland Plasma session, maybe that plays into it, considering the other thread where there's problems with Emacs/X interplay (iirc).
 
Old 03-28-2024, 03:18 PM   #7
slac-in-the-box
Member
 
Registered: Mar 2010
Location: oregon
Distribution: slackware64-15.0 / slarm64-current
Posts: 780
Blog Entries: 1

Rep: Reputation: 432Reputation: 432Reputation: 432Reputation: 432Reputation: 432
I've been having to build emacs by hand from its git sources, or it was crashing when in emacs orgmode; don't know if that crash is related to your observed ram consumption and increased cpu; but just chiming in that I was having to replace the stock package in my slackware64-15 use cases.
 
1 members found this post helpful.
Old 04-08-2024, 10:56 AM   #8
marabunta
LQ Newbie
 
Registered: Sep 2023
Location: Buenos Aires city, Argentina
Distribution: Slackware
Posts: 9

Rep: Reputation: 5
I experienced this issue too, and it froze my machine with 8GB of RAM multiple times. I had to power it off.

I too had some packages installed: magit, js2-mode, git-gutter, projectile, php-mode.

I was using Plasma on X11, not Wayland.
 
1 members found this post helpful.
Old 04-08-2024, 11:06 AM   #9
marabunta
LQ Newbie
 
Registered: Sep 2023
Location: Buenos Aires city, Argentina
Distribution: Slackware
Posts: 9

Rep: Reputation: 5
8GB of RAM and 8GB of swap. It filled both of them.
I know because I was running a system monitor on a SSH session.
 
1 members found this post helpful.
Old 04-08-2024, 11:34 AM   #10
marabunta
LQ Newbie
 
Registered: Sep 2023
Location: Buenos Aires city, Argentina
Distribution: Slackware
Posts: 9

Rep: Reputation: 5
By the way, Emacs 29.3 has other problems. Some commands crash Emacs with a backtrace when in text mode (emacs -nw). For example M-x list-packages.
 
1 members found this post helpful.
Old 04-08-2024, 03:04 PM   #11
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
My emacs server crashes with this

Code:
Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Loading ~/.config/emacs/custom.el (source)...
Importing package-keyring.gpg...
emacs: writing to child signal FD: Bad file descriptor
Backtrace:
emacs[0x577bf3]
emacs[0x425b3e]
emacs[0x4260b3]
emacs[0x42ae75]
emacs[0x62e5b4]
emacs[0x61ef61]
emacs[0x5de79b]
emacs[0x5dd243]
emacs[0x5dd7dd]
emacs[0x5dd551]
emacs[0x60b5ba]
emacs[0x60c7a1]
emacs[0x61ef61]
emacs[0x5d9867]
emacs[0x60c420]
emacs[0x5dd4d5]
emacs[0x5dd7dd]
emacs[0x5dd551]
emacs[0x5dd551]
emacs[0x60b5ba]
emacs[0x60c7a1]
emacs[0x61ef61]
emacs[0x5d9867]
emacs[0x60c420]
emacs[0x61ef61]
emacs[0x5de79b]
emacs[0x5dd243]
emacs[0x5df69a]
emacs[0x5d813f]
emacs[0x55696d]
emacs[0x5d80a3]
emacs[0x555f03]
emacs[0x55a80c]
emacs[0x55ab77]
emacs[0x42e038]
/lib64/libc.so.6(__libc_start_main+0xcd)[0x7f5c992b603d]
emacs[0x42e5ba]
Error: server did not start correctly
But when launched as standalone and gui it works. Kinda : 15 seconds for 50 packages loaded...

Last edited by Tonus; 04-08-2024 at 03:05 PM. Reason: Get the error in english
 
1 members found this post helpful.
Old 04-08-2024, 05:26 PM   #12
gattocarlo
Member
 
Registered: Jan 2020
Posts: 63

Rep: Reputation: Disabled
Quote:
Originally Posted by marabunta View Post
By the way, Emacs 29.3 has other problems. Some commands crash Emacs with a backtrace when in text mode (emacs -nw). For example M-x list-packages.
same here in when started as a daemon (even with X11)...

actually the same occasionally happened also with emacs-27 when exiting the server buffer in gnus... quite annoying: lately emacs is becoming quite unstable. what a pity...
 
1 members found this post helpful.
Old 04-08-2024, 05:48 PM   #13
gattocarlo
Member
 
Registered: Jan 2020
Posts: 63

Rep: Reputation: Disabled
Quote:
Originally Posted by Tonus View Post
My emacs server crashes with this

Code:
Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
...
just recompiled with the athena (lucid) toolkit and indeed it doesn't crash in daemon mode anymore... hopefully this was the bug that was biting me... thanks for the hint!
 
1 members found this post helpful.
Old 04-10-2024, 10:53 PM   #14
thirdm
Member
 
Registered: May 2013
Location: Massachusetts
Distribution: Slackware, NetBSD, Debian, 9front
Posts: 317

Rep: Reputation: Disabled
I've seen that warning about gtk a lot, on Slackware and on Ubuntu at work, but don't recall an abort while I was actively using emacsclient and daemon. I do notice emacs core files sometimes (on NetBSD I think and maybe not on Slackware), so I'm guessing I get an abort when shutting down X without stopping the emacs daemon (with some version of emacs).

So far I've gotten the abort with the thread list two ways. One was before removing these two customizations...
Quote:
- '(desktop-restore-eager 20)
- '(desktop-save-mode t)
When I had those and another active emacs (emacs --daemon but I'm guessing it wouldn't matter what kind) and I run emacs -nw I'd get this question on start up...
Quote:
Warning: desktop file appears to be in use by PID 1449.
Using it may cause conflicts. Use it anyway? (y or n)
If I type 'y' I get an abort...
Quote:
1016r0~% emacs -nw
Fatal error 6: Aborted
Backtrace:
emacs[0x577bf3]
emacs[0x425b3e]
emacs[0x4260b3]
emacs[0x42ae75]
emacs[0x438ba6]
...
emacs[0x42e038]
/lib64/libc.so.6(__libc_start_main+0xcd)[0x7f91ce4e203d]
... [that's verbatim, the early one is me leaving out threads]
Abort
If I type 'n' it starts fine and I can run list-packages without an abort...
Warning: desktop file appears to be in use by PID 1449.
Using it may cause conflicts. Use it anyway? (y or n) n
Desktop file in use; not loaded.
For information about GNU Emacs and the GNU system, type C-h C-a.
Importing package-keyring.gpg...done
Package refresh done

The 2nd way was that earlier I had an invalid emacs package url. Shortly after the error about that popped up it would abort if started as emacs -nw (that test was as a 2nd emacs instance two and pressing 'n' for the desktop question IIRC).

I no longer get an abort with desktop mode off and with the bad url removed, though I did see an error message about an invalid file descripter flash by when running list-packages. It may have only been written to stderr (or stdout?). I'm not seeing it in .xsession-errors or in emacs's message buffer.

I've made a note to try to debug this sometime, er maybe.

I continue to see relatively moderate memory usage and no performance problems when emacs does not abort, and it doesn't at all in my normal usage, but I don't care for console only emacs and don't use it much:

Quote:
984r0~% pgrep -al emacs
1471 emacs
6344 emacs -nw
6424 emacs --daemon
6427 emacsclient -c -F ((width . 92) (height . 38) (top . -25) (left . 220))
6446 emacs --nw
986r1~% sh
sh-5.1$ for p in 1471 6344 6424 6427 6446; do ps u $p; done
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
smallm 1471 0.0 0.0 0 0 ? Z 20:16 0:00 [emacs] <defunc
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
smallm 6344 0.9 3.1 589100 121732 pts/0 Tl 23:22 0:12 emacs -nw
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
smallm 6424 1.4 3.3 763384 128636 ? Ssl 23:31 0:10 emacs --daemon
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
smallm 6427 0.0 0.0 2464 740 ? S 23:31 0:00 emacsclient -c
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
This is all with Slackware 15.0, Emacs 29.3, Xorg, and a window manager only modestly changed from twm.

Last edited by thirdm; 04-10-2024 at 10:56 PM. Reason: weird sentence
 
Old 04-11-2024, 08:28 AM   #15
drgibbon
Senior Member
 
Registered: Nov 2014
Distribution: Slackware64 15.0
Posts: 1,220

Rep: Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943
Quote:
Originally Posted by marabunta View Post
By the way, Emacs 29.3 has other problems. Some commands crash Emacs with a backtrace when in text mode (emacs -nw). For example M-x list-packages.
For what it's worth I compile Emacs 29.3 with a modified SlackBuild (including native compilation) on 15.0 (Plasma/X11), and I'm not seeing this crash, nor the memory leak issue.
 
  


Reply

Tags
emacs 29, slackware 15.0



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error executing emacs after attempt to upgrade to emacs 28.1 davebru Slackware - Installation 1 06-10-2022 09:58 AM
Xorg using extremely high amounts of memory (memory leaks?) HikoHaieto Linux - Software 2 04-07-2013 02:04 AM
How can I get emacs -nw when I call emacs from a terminal but GUI emacs elsewhere? Blackened Justice Linux - Newbie 4 09-08-2011 07:57 AM
Memory leaks.. *** glibc detected *** ./SuffixTree: malloc(): memory corruption: 0x00 evansash Programming 12 03-21-2011 01:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration