From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Memory usage report Date: Sat, 19 Sep 2020 08:29:37 +0800 Message-ID: <87tuvuehhq.fsf@localhost> References: <87lfh8kyot.fsf@gnus.org> <83k0ws5hzt.fsf@gnu.org> <87h7rwkxtk.fsf@gnus.org> <83imcb61p7.fsf@gnu.org> <871rizl5mf.fsf@gnus.org> <83r1qz48h3.fsf@gnu.org> <871rizjogr.fsf@gnus.org> <83pn6j45rr.fsf@gnu.org> <87wo0ri6kz.fsf@gnus.org> <83o8m34433.fsf@gnu.org> <87imcb43e3.fsf@localhost> <83k0wr4222.fsf@gnu.org> <87ft7f40p8.fsf@localhost> <83h7rv3xsc.fsf@gnu.org> <87wo0rdpud.fsf@localhost> <838sd6522b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1549"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 19 02:32:09 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJQnQ-0000HF-Fq for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Sep 2020 02:32:08 +0200 Original-Received: from localhost ([::1]:49288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJQnP-00043J-IC for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Sep 2020 20:32:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJQm5-0003ck-8C for emacs-devel@gnu.org; Fri, 18 Sep 2020 20:30:45 -0400 Original-Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:45856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJQm3-0008E4-AG; Fri, 18 Sep 2020 20:30:44 -0400 Original-Received: by mail-pg1-x52d.google.com with SMTP id 67so4395495pgd.12; Fri, 18 Sep 2020 17:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=cGHV32D7nLw09VPs7Zht2yGYeLBRplbFiRv53x4xnyk=; b=t/t2V0sgra31YYNhwymEQ3Xw6UHXEr8rcdZYhk36ifzCd3XkUuaZlLNumlQx1mUS0f IFKfLi4qRTozxNbvMXB8zi/v8HprXUr2ay2TgkA/SDk4SNt/XrNQAKzgYveMY1dk89Rr xS8PMq0Rc3fXOdzekJTLcGXzSQUPu1RCwpckc5Q8B15wDaifk+Rl4uLQhJ/FoJVxy2UB PQmhyIklnvvJ5tpo4U0/Otgwcr4d/GTHo4wCMmTMBn/MbH2xJf9VpTKIqeBJF2EOgtV8 vZ4EBF/t+xUW3JKQoS6NztnFa+eOI+yb++2uqy3iK368FTWLgIJNe4ctG+Q3mN5dtRlp fcdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=cGHV32D7nLw09VPs7Zht2yGYeLBRplbFiRv53x4xnyk=; b=C/AwfAXjhbrEtfofqQO3ESGCDTkDIUus8xuWEhgqXKfw68MzwFJJ2YeT51ou11b23G +mm31R42Y4WWsNJ6CbUqs0UsVQnMwcMKlS3aXRJsXFYtDnaAp5Wd/ZlptOO5r3Vis1HJ yXcTuETMiqoCmdKxce0Ke2Wvv8/HhR0+LBrH1A/A6xvevM+J/2sL9cqlg+Un0YaxmS0F 93NHrcDx6MMnwidkS5jcW9Q41LwqbiE/wKe22JO6ORoQd+VEzAZP+SbXHkOf7F1YlF6k M5l1tCzZwu6Gk9h0oGYyXPsveCblgxqOwxfR9PFVaTUqppdPejLL6SYU3p0ETdYYP3wY NGUw== X-Gm-Message-State: AOAM5336XkeQzCMbHdC8jHRACpqsY8TGR7vOx7V/X1hIMOrKeQEMAvzl kf3iMl4FlJ19wGOc4CBUDfHzwBhBQY5WqA7t X-Google-Smtp-Source: ABdhPJzMD8IwMNOHmf4ZS2F/Fd8/QIwdCn+1jwh90A1LIKwJk0ZBazMGToIAp8Hu9tLP7pI1bateiw== X-Received: by 2002:a63:f53:: with SMTP id 19mr29186090pgp.26.1600475441121; Fri, 18 Sep 2020 17:30:41 -0700 (PDT) Original-Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id w10sm4502661pgr.27.2020.09.18.17.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 17:30:40 -0700 (PDT) In-Reply-To: <838sd6522b.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:256140 Archived-At: > Where do you see evidence for a significant memory in > the heap? top shows more than 200Mb memory increase. > So the interesting question is: where are those 7GB used? 1Gb in lisp objects and 20%*8Gb=1.6Gb total. I am not sure about those extra 0.6Gb, but answering about the 1Gb in lisp objects would also help. That's why I asked earlier about buffer-local variable summary and summary about library variables. > And that is actually the bottom line here: the GBytes of memory used > by such large Emacs sessions don't seem to come from Lisp objects, > they are used up in some other way. The question is how and where in > the code this happens. While I would also like to answer this question, I also have large fraction of lisp objects. As I mentioned in previous emails (sorry if I was not clear), I would appreciate some way to understand why my **lisp object** memory grew from 283Mb right after loading my org files to 1Gb later. P.S. I tried to use memory profiler to understand the memory usage, but the memory profiler report appear to show peak memory usage (there tend to be functions with many let-bindings). So, it seems not be to useful for me (correct me if I am wrong). Best, Ihor Eli Zaretskii writes: >> From: Ihor Radchenko >> Cc: larsi@gnus.org, emacs-devel@gnu.org >> Date: Sat, 19 Sep 2020 00:14:34 +0800 >> >> Before: >> Total in lisp objects: 77.4MB (live 47.7MB, dead 29.7MB) >> Buffer ralloc memory usage: >> 16 buffers >> 39.3kB total (23.6kB in gaps) >> >> After: >> Total in lisp objects: 283MB (live 218MB, dead 64.7MB) >> Buffer ralloc memory usage: >> 47 buffers >> 6.79MB total (78.6kB in gaps) >> >> This is not all the memory increase. Some part seems to be in heap. > > I see almost all of the 200MB of additional memory in Lisp objects: > mainly conses, the rest in vectors and intervals (i.e. text > properties). Where do you see evidence for a significant memory in > the heap? > > I guess you could ask Org developers a question regarding this high > memory usage. In any case, this is not what people report in > bug#43389, or so it seems. > >> Also, the memory usage is even worse when org-mode is using overlays (I >> am on org-mode branch using text properties instead of overlays in org). > > Looks like you have 30 Org buffers whose total size is below 10MB? If > they use a lot of text properties and overlays, it's a small wonder > you get high memory usage. I don't necessarily see a problem here. > >> The memory consumption gets even worse after I use Emacs for several >> hours. Recently, it tend to settle around 20% (of 8Gb) with lisp objects >> taking around 1Gb. > > So the interesting question is: where are those 7GB used? > >> This last part is the most annoying and also difficult to track - I have >> no easy way to know if it is also caused by org-mode or it is something >> else. > > The only way to investigate this is to use a good memory-mapping > utility and perhaps also a debugging malloc library. > > And that is actually the bottom line here: the GBytes of memory used > by such large Emacs sessions don't seem to come from Lisp objects, > they are used up in some other way. The question is how and where in > the code this happens.