all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to debug memory leaks
Date: Fri, 26 Mar 2021 17:11:02 +0100	[thread overview]
Message-ID: <AM9PR09MB4977A297DD93D66B2E87FFD196619@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <83ft0hq4wb.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Mar 2021 19:03:00 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Fri, 26 Mar 2021 16:53:58 +0100
>> 
>> >> Yes, but GC can't know if I don't need undo history, right
>> >
>> > And neither do you.  GC compacts the undo history, though, and frees
>> > the slack.
>> 
>> Ok, good if GC compacts the undo, but I could explicitly wish/know
>> sometimes that I could "freeze" the undo. I could just put on my own
>> interactive command that does this instead of using
>> M-: (setq buffer-undo-list nil), but there could be some other stuff
>> based on mode, like eshell or term or I don't know what. That could help
>> GC.
>
> You will have to come up with more specific ideas, the above is too
> general to be useful.  If you suggest that some modes don't need undo,
> then I don't think I agree.

No, no, I don't mean that some modes don't need undo. I mean, if I am
working in a buffer, say some C file, and I think Emacs get sluggish, I
could do some M-x clean-buffer and have it setq bunch of variables to
nil, amongst them undo so GC can collect them. It is just that these
variables might be different depending of type of buffer, active modes
etc. I can of course do my own interactive command. But it is maybe
better if there was a "standard" hook which mode writers can use, and
standard command, so users like me don't need to write their own.

>> >> or old text in eshell buffer?
>> >
>> > Delete it, and it will be free'd.
>> 
>> Yes, so that is what I am saying; a hook to put all kind of various
>> "delete" stuff for various modes so we can run interactive command, say
>> "clean-buffer" or whatever, and it will run the apropriate "deletes" and
>> maybe other stuff based on mode.
>
> You have post-command-hook already; if you want to keep only a small
> part of a shell buffer, you can use that hook to delete the old
> stuff.  This is clearly specific to your use patterns, though.

Ok, I didn't know I can use post-command-hook for that. I'll try and
play with it. Thanks.

> And after all that, please keep in mind that in all the reports about
> multi-GB memory footprints that people complained about, the actual
> memory used by Lisp objects (what GC can free) was quite small, almost
> negligible.  The real problem, whatever it was, wasn't with GC not
> freeing enough.

To be honest, I don't really think it is very much needed, more of a "in
case of" thing. Lately I haven't experienced any memory problems with
Emacs, and it feels fast and responsive as ever before. So well done job
there.

>> Just as a note: no idea if you have found the memory leak or not, the
>> big one that everyone was repporting few weeks ago, but I haven't
>> experienced any leaks or slugishness with lately builds. I guess you
>> found it? :).
>
> Not really.  We fixed a problem where fiddling with some GC-related
> options could cause Emacs stop calling GC, but that's all.

Ok, seems like it works well now.



  reply	other threads:[~2021-03-26 16:11 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  5:29 How to debug memory leaks 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 [this message]
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-26 15:10             ` boost interactive feel speed (was: Re: How to debug memory leaks) Emanuel Berg via Users list for the GNU Emacs text editor
  -- strict thread matches above, loose matches on Subject: below --
2021-03-25 22:21 How to debug memory leaks edgar
2021-03-21 18:17 edgar
2021-03-21 18:25 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR09MB4977A297DD93D66B2E87FFD196619@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.