From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Emacs memory management and sluggishness Date: Fri, 26 Jul 2019 21:20:17 +0200 Message-ID: <87k1c44n7y.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="258224"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 26 21:20:36 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hr5la-00151s-N3 for ged-emacs-devel@m.gmane.org; Fri, 26 Jul 2019 21:20:34 +0200 Original-Received: from localhost ([::1]:43070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr5lZ-0006RT-0N for ged-emacs-devel@m.gmane.org; Fri, 26 Jul 2019 15:20:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47529) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hr5lQ-0006Qz-Kx for emacs-devel@gnu.org; Fri, 26 Jul 2019 15:20:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hr5lP-0002t4-Ib for emacs-devel@gnu.org; Fri, 26 Jul 2019 15:20:24 -0400 Original-Received: from relayout04-redir.e.movistar.es ([86.109.101.204]:15121) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hr5lP-0002gw-9v for emacs-devel@gnu.org; Fri, 26 Jul 2019 15:20:23 -0400 Original-Received: from sky (162.red-79-151-6.dynamicip.rima-tde.net [79.151.6.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 981711563@telefonica.net) by relayout04.e.movistar.es (Postfix) with ESMTPSA id 45wJnY5t6Nz1293 for ; Fri, 26 Jul 2019 21:20:17 +0200 (CEST) X-CTCH-Score: 0.000 X-CTCH-ScoreCust: 0.000 X-TnetOut-Country: IP: 79.151.6.162 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout04 X-TnetOut-MsgID: 45wJnY5t6Nz1293.A12CE X-TnetOut-SpamCheck: no es spam, Unknown X-TnetOut-From: ofv@wanadoo.es X-TnetOut-Watermark: 1564773619.3797@Rb6Qm4BEn040EO5ATFczBg X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.109.101.204 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238936 Archived-At: [I sent this message through gmane hours ago and so far it was not posted, sorry for the duplicate if it finally arrives] GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit) of 2019-06-29 M-x emacs-runtime says this session is running for 26 days. Light usage. Right now its RSS is 1.1 GB. I don't open huge files (rarely they are larger than 200 KB, except for Gnus (?) opening sent-news and sent-mail, which are about 5MB each). Sometimes I read PDF documents with PDF-Tools, which amounts to an image-viewer plus the length of the PDF file, being the largest one 6 MB. Since a week or two typing normal text (i.e. writing this message) even in Fundamental Mode shows an annoying lag betwenn the keypress and the character showing on the screen. Sometimes it affects entire key sequences, and I'm no fast typist. So my questions are: do we have a problem with memory fragmentation? because with the same usage pattern the memory keeps growing. And could this cause the lag I described above? At this moment, simply typing text makes Emacs CPU usage go over 50% of a core (on a fast desktop machine). This does not happen on a fresh instance with the same configuration. I see the lag increases on correlation with the memory increase. Apart from Evil-mode, I have no other edition-related modes apart from what Emacs itself activates, and disabling Evil makes no difference. P.S.: profiling indicates that about 80% of the CPU samples are on Automatic GC. Maybe the cause is running the GC over such large memory area. (garbage-collect) returns ((conses 16 4505904 1124616) (symbols 48 76877 18) (strings 32 340997 83083) (string-bytes 1 10456288) (vectors 16 688370) (vector-slots 8 24140524 2173062) (floats 8 1621 1825) (intervals 56 112123 94665) (buffers 992 449)) I wonder how this ends using 1.1 GB of RSS. (memory-limit) returns 1874140 (#o7114334, #x1c98dc) (memory-use-counts) returns (3617372752 2210912 8232217138 506599 2689836943 19615159 67629016) gc-elapsed returns 1901.1549781709962 htop says that emacs used 2h38m of CPU so far.