all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, emacs-devel@gnu.org
Subject: Re: Memory usage report
Date: Sat, 19 Sep 2020 23:14:52 +0800	[thread overview]
Message-ID: <87k0wper2r.fsf@localhost> (raw)
In-Reply-To: <83d02h3jj2.fsf@gnu.org>

> I think the more useful question is: are all those overlays and text
> properties necessary?  If they are, they take the memory they are
> supposed to take.

Some of the overlays and text properties are not strictly necessary.
For example, text properties are sometimes used as cache to avoid
parsing text multiple times. Is the resulting speedup worth extra memory
usage? It is not clear since we do not have an easy way to determine the
extra memory usage. 

>> Thanks! I did not know that. Would it be possible to have a "real"
>> memory profiler showing how much the memory usage changed after-before
>> running separate functions?

> If you mean memory used by Lisp objects, then GC reports that.
>
> If you mean memory used by non-Lisp objects, I don't see how we could
> produce that without having infrastructure for tracking memory
> allocation, something that debugging malloc libraries already do.

Hmm. I am looking again at the profiler-report output. It seems to
report the memory allocation for individual function calls (that's what
I meant by "real" memory profiler). Do I miss something?

Function                                                  Bytes        %

- command-execute                                         516,227,475  77%
 - call-interactively                                     516,222,195  77%
  - funcall-interactively                                 516,222,195  77%
   - helm-M-x                                             203,107,508  30%
    - helm-M-x-read-extended-command                      203,107,508  30%
     - helm                                               202,313,652  30%
      - apply                                             202,310,580  30%
       - helm                                             202,310,580  30%
        - apply                                           202,310,580  30%
         - helm-internal                                  202,310,580  30%
          - helm-display-buffer                           112,541,910  16%
           - helm-default-display-buffer                  112,540,854  16%
            - display-buffer                              112,540,854  16%
             - display-buffer--maybe-pop-up-frame-or-window   112,540,854  16%
              - display-buffer--maybe-pop-up-window       112,540,854  16%
               - display-buffer-pop-up-window             112,540,854  16%
                + window--try-to-split-window              56,401,971   8%
                  window--display-buffer                   56,130,435   8%
                  window--maybe-raise-frame                     5,280   0%

Best,
Ihor


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Ihor Radchenko <yantar92@gmail.com>
>> Cc: larsi@gnus.org, emacs-devel@gnu.org
>> Date: Sat, 19 Sep 2020 22:34:28 +0800
>> 
>> >> top shows more than 200Mb memory increase.
>> >
>> > Which are explained by the statistics produced by GC.  IOW, you have
>> > many more live Lisp objects, which take up those megabytes.
>> 
>> I meant that 200Mb is Lisp objects, but top shows more then 200Mb
>> (around 300Mb). So, there is extra 100Mb coming from somewhere else.
>
> I got a different (smaller) value, but it isn't worth to continue this
> argument.
>
>> > Since that's related to Org buffers, the best place to discuss this is
>> > on Org mailing lists.  Perhaps there are ways to make Org use less
>> > memory, but the expertise for that is there.
>> 
>> The problem is how to identify where the memory usage is coming from.
>> Indeed, org is using overlays and text properties extensively. But how
>> much do those influence the memory usage?
>
> I think the more useful question is: are all those overlays and text
> properties necessary?  If they are, they take the memory they are
> supposed to take.
>
>> > The "memory" profiler doesn't measure the usage of memory, it measures
>> > CPU usage triggered by memory allocation calls (instead of the
>> > periodic profiling signal).  So this profile is not supposed to be
>> > useful for profiling memory usage.
>> 
>> Thanks! I did not know that. Would it be possible to have a "real"
>> memory profiler showing how much the memory usage changed after-before
>> running separate functions?
>
> If you mean memory used by Lisp objects, then GC reports that.
>
> If you mean memory used by non-Lisp objects, I don't see how we could
> produce that without having infrastructure for tracking memory
> allocation, something that debugging malloc libraries already do.



  reply	other threads:[~2020-09-19 15:14 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 19:09 Memory usage report Lars Ingebrigtsen
2020-09-17 19:19 ` Eli Zaretskii
2020-09-17 19:28   ` Lars Ingebrigtsen
2020-09-18  6:25     ` Eli Zaretskii
2020-09-18 10:51       ` Lars Ingebrigtsen
2020-09-18 11:42         ` Eli Zaretskii
2020-09-18 11:47           ` Lars Ingebrigtsen
2020-09-18 12:40             ` Eli Zaretskii
2020-09-18 12:59               ` Lars Ingebrigtsen
2020-09-18 13:17                 ` Eli Zaretskii
2020-09-18 13:32                   ` Ihor Radchenko
2020-09-18 14:00                     ` Eli Zaretskii
2020-09-18 14:08                       ` Lars Ingebrigtsen
2020-09-18 15:15                         ` Stefan Monnier
2020-09-18 15:19                           ` Lars Ingebrigtsen
2020-09-18 15:44                             ` Eli Zaretskii
2020-09-19 14:27                               ` Lars Ingebrigtsen
2020-09-19 14:48                                 ` Eli Zaretskii
2020-09-18 15:27                         ` Eli Zaretskii
2020-09-18 14:30                       ` Ihor Radchenko
2020-09-18 15:33                         ` Eli Zaretskii
2020-09-18 15:37                           ` Lars Ingebrigtsen
2020-09-18 15:50                             ` Eli Zaretskii
2020-09-19 14:23                               ` Lars Ingebrigtsen
2020-09-18 16:14                           ` Ihor Radchenko
2020-09-18 19:15                             ` Eli Zaretskii
2020-09-19  0:29                               ` Ihor Radchenko
2020-09-19  7:51                                 ` Eli Zaretskii
2020-09-19 14:29                                   ` Lars Ingebrigtsen
2020-09-19 14:46                                     ` Eli Zaretskii
2020-09-19 14:54                                       ` Lars Ingebrigtsen
2020-09-19 15:34                                         ` Eli Zaretskii
2020-09-19 15:40                                     ` Stefan Monnier
2020-09-20  9:10                                       ` Lars Ingebrigtsen
2020-09-19 14:34                                   ` Ihor Radchenko
2020-09-19 14:53                                     ` Eli Zaretskii
2020-09-19 15:14                                       ` Ihor Radchenko [this message]
2020-09-19 15:36                                         ` Eli Zaretskii
2020-09-19 15:45                                           ` Ihor Radchenko
2020-09-19 16:05                                             ` Eli Zaretskii
2020-09-19 15:43                                     ` Stefan Monnier
2020-09-19 16:08                                       ` Ihor Radchenko
2020-09-19 16:18                                         ` Stefan Monnier
2020-09-17 19:45 ` Stefan Monnier

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=87k0wper2r.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.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.