From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Memory again Date: Tue, 06 Dec 2011 08:07:46 -0500 Message-ID: References: <4ED0F945.5090805@yandex.ru> <83pqge7syw.fsf@gnu.org> <87mxb6tkji.fsf@wanadoo.es> <4EDDED4B.7030607@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1323176881 13170 80.91.229.12 (6 Dec 2011 13:08:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Dec 2011 13:08:01 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 06 14:07:57 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RXukW-0001u1-UE for ged-emacs-devel@m.gmane.org; Tue, 06 Dec 2011 14:07:57 +0100 Original-Received: from localhost ([::1]:34888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXukW-0005j7-7s for ged-emacs-devel@m.gmane.org; Tue, 06 Dec 2011 08:07:56 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:46245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXukS-0005hy-TM for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:07:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXukM-0004OQ-RY for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:07:52 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:35515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXukM-0004OM-Q8 for emacs-devel@gnu.org; Tue, 06 Dec 2011 08:07:46 -0500 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RXukM-0005r6-Na; Tue, 06 Dec 2011 08:07:46 -0500 In-reply-to: <4EDDED4B.7030607@yandex.ru> (message from Dmitry Antipov on Tue, 06 Dec 2011 14:24:11 +0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146501 Archived-At: > Date: Tue, 06 Dec 2011 14:24:11 +0400 > From: Dmitry Antipov > > On 12/06/2011 01:35 PM, Carsten Mattner wrote: > > > I still believe this is what's happening for me on Linux 3.x and Darwin 10.7.x > > when I kill a buffer and the claimed memory is not given back to the kernel. > > Yes, it's very easy to reproduce. Generate the following C code: > > #warning oops0 > #warning oops1 > /* a lot of */ > #warning oops999999 > main () {} > > then M-x compile it, wait a lot until it's done, then kill *compilation* > buffer and see RSS. I don't think this extreme case is very interesting. For that matter, I don't think Carsten's use case is even remotely similar. > I tried with 1M of #warnings, and (buffer-size *compilation*) was 58M - but > RSS grows to 2250M. During compilation, strace shows an excessive usage both > of mremap() (for buffer text, I suppose) and brk(). When I kill *compilation*, > munmap() was issued to free buffer text. Next, I call garbage-collect: > > ((63789 . 19159) (15579 . 0) (45 . 234) 160925 331403 (74 . 320) (696 . 251) (6794 . 10907)) > > But even after GC, RSS is 2192M. Oops. If you then re-run the same compilation again, you should see the RSS grow by very little, not by another 2GB. If so, then at least Emacs reuses the memory as efficiently as it can. But again, this use case is IMO not interesting in practice.