all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to debug memory leaks
@ 2021-03-21 18:17 edgar
  2021-03-21 18:25 ` Eli Zaretskii
  0 siblings, 1 reply; 33+ messages in thread
From: edgar @ 2021-03-21 18:17 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]

Hello,

I have noticed that my Emacs setup keeps using all my RAM, and it then 
goes for my swap memory. I think that it is leaking memory.

My use of Emacs at the moment is to work with a C++ finite element 
library (libMesh), and I am using Org to create literate programming. I 
am currently not doing any LaTeX (or otherwise fancy) exporting, but 
Org-ref does get loaded, among others and I also do unicode text 
exporting to make sure that some things would be included (#+include: 
my_file::block_name src cpp). I work with Makefiles and use the compile 
command from Emacs, as much as shell-command if needed. I am also trying 
to use helm-gtags. There is company running as well.

I noticed that when the 17.9 MB TAGS file (Global gtags) is read, the 
memory use jumps a lot and keeps increasing. It seems that font leaking 
is a common issue as well. For both reasons, I already deactivated 
moe-theme and projectile, and I keep doing garbage-collect constantly, 
all of which seems to have helped. However, the problem subsists.

I tried to follow what seemed to be the most instructive way of 
debugging this 
http://notes.secretsauce.net/notes/2015/10/05_memory-leak-debugging-tools.html). 
However, I get errors unbeknownst to me. Namely:

     The /usr/lib/libc-2.33.so file has no debug information.
Rebuild with -g, or install an appropriate debuginfo package.
   Error: Failed to add events.

     Error:	File /sys/kernel/debug/tracing/events/probe_libc/free not 
found.
Hint:	Perhaps this kernel misses some CONFIG_ setting to enable this 
feature?.

It is clear that I would have to recompile my kernel with debugging 
symbols, but that seems too much.

I attach a file with info on my Linux, Emacs version and the packages 
that I use. I hope that someone can help me to find and correct the 
memory leak, or point me in the right direction. Thanks.

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

[-- Attachment #2: emacs-config-mem-leak.txt.gz --]
[-- Type: application/x-gzip, Size: 2693 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Re: How to debug memory leaks
@ 2021-03-25  5:29 edgar
  2021-03-25 14:23 ` Stefan Monnier
  2021-03-25 17:54 ` edgar
  0 siblings, 2 replies; 33+ messages in thread
From: edgar @ 2021-03-25  5:29 UTC (permalink / raw)
  To: help-gnu-emacs

 From: 	Eli Zaretskii

> It's unlikely.

Yet, it happened--more than once (did you notice that I said "my Emacs 
setup" and not "Emacs"?). The good news: it's not happening anymore :)

> I'd start by looking in your init files for any customization that 
> affects GC.
> 
> Also, if you use Emacs 27.1, try the RC2 release candidate of Emacs 
> 27.2, I think it fixed a problem which could create a situation where 
> GC is prevented.

So very interesting. I did have an Emacs compiled by my system, but when 
the problem surfaced, I went for my distro's package to see if that 
would solve it (not really). When I brought moe-theme back, I disabled 
the DejaVu Sans Mono font, and Emacs behaved well. It was really loading 
the TAGS which added like 400 MB on the stack (virtual and 
resident--yeah, sounds unlikely, right?). Therefore, I went to look for 
an alternative.

I am not a fan of having a subprocess running, but after trying eglot 
with clangd, I was convinced that 150 MB more on my stack would be 
acceptable. Even more, because it goes away once the buffer is closed.

I haven't done a garbage collect, and I know that having near 750 MB in 
virtual and 140 MB in resident memory is still a lot, but it is at least 
not +4 GB in between RAM and swap.

I would next compile Emacs, but I'll settle for this right now, and get 
some work done.

Thank you, Eli and all the developers for providing the world with the 
most customisable editor ever! (sorry to Mr. Stallman for calling it an 
editor)



^ permalink raw reply	[flat|nested] 33+ messages in thread
* Re: How to debug memory leaks
@ 2021-03-25 22:21 edgar
  0 siblings, 0 replies; 33+ messages in thread
From: edgar @ 2021-03-25 22:21 UTC (permalink / raw)
  To: help-gnu-emacs

 From: 	Stefan Monnier
> Sorry for the thread misdirection, indeed.
> 
> It's actually really hard.  So the best is to `M-x report-emacs-bug` 
> and
> contribute as much concrete data as you can.  If you use an Emacs built
> from Git, you can also include `M-x memory-report` as part of the hard 
> data.

Wow! A real gentleman... on internet? Nah, I must be dreaming ;) . Thank 
you, Stefan.



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2021-03-27 15:30 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-21 18:17 How to debug memory leaks edgar
2021-03-21 18:25 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2021-03-25  5:29 edgar
2021-03-25 14:23 ` Stefan Monnier
2021-03-25 15:01   ` Jean Louis
2021-03-25 15:18     ` Stefan Monnier
2021-03-25 20:15       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 17:54 ` edgar
2021-03-25 18:26   ` Stefan Monnier
2021-03-25 19:38   ` Jean Louis
2021-03-25 22:24     ` edgar
2021-03-26  5:48       ` Robert Thorpe
2021-03-26  5:58         ` edgar
2021-03-26 14:11         ` Stefan Monnier
2021-03-26 14:17           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 14:23             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 14:57           ` Arthur Miller
2021-03-26 15:02             ` Eli Zaretskii
2021-03-26 15:09               ` Arthur Miller
2021-03-26 15:33                 ` Eli Zaretskii
2021-03-26 15:53                   ` Arthur Miller
2021-03-26 16:03                     ` Eli Zaretskii
2021-03-26 16:11                       ` Arthur Miller
2021-03-26 16:25                         ` Stefan Monnier
2021-03-26 16:32                           ` Arthur Miller
2021-03-26 16:44                             ` Stefan Monnier
2021-03-26 18:02                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 18:31                                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-27  8:20                               ` Arthur Miller
2021-03-27 15:03                                 ` Stefan Monnier
2021-03-27 15:13                                   ` Arthur Miller
2021-03-27 15:30                                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 22:21 edgar

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.