From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carsten Mattner Newsgroups: gmane.emacs.devel Subject: Re: Memory again Date: Thu, 8 Dec 2011 18:30:53 +0100 Message-ID: References: <4ED0F945.5090805@yandex.ru> <83pqge7syw.fsf@gnu.org> <87mxb6tkji.fsf@wanadoo.es> <4EDDED4B.7030607@yandex.ru> <8362htbos6.fsf@gnu.org> <4EDF20A7.6090701@yandex.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1323365473 26503 80.91.229.12 (8 Dec 2011 17:31:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2011 17:31:13 +0000 (UTC) Cc: Eli Zaretskii , Dmitry Antipov , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 08 18:31:09 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 1RYhoK-0007on-Hh for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2011 18:31:08 +0100 Original-Received: from localhost ([::1]:43248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYhoJ-0004Tv-PN for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2011 12:31:07 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYhoG-0004Rd-Td for emacs-devel@gnu.org; Thu, 08 Dec 2011 12:31:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYhoC-0001pH-VG for emacs-devel@gnu.org; Thu, 08 Dec 2011 12:31:04 -0500 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:61246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYho7-0001ox-ID; Thu, 08 Dec 2011 12:30:55 -0500 Original-Received: by qan41 with SMTP id 41so788647qan.0 for ; Thu, 08 Dec 2011 09:30:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BRP5MaZKXBwdFkZaamibbAcMHMw2TA8+6SqoVVTh2Qc=; b=IoaYajd2xzCQlW1rSc1PsLIH8w6A6I0wNCku8gfdahV1JIrs1jQAy4KAzRZW9shYAO 4N3OnegvROVW68Vl4bieoXCxIXTMR7iThCzUkkW43U5Oj71dzerChYaEHCxREnWTiRrj QA7UyuU0TUVKkH041LQFYVQhqawtk/6fU351o= Original-Received: by 10.50.94.229 with SMTP id df5mr4469220igb.27.1323365454328; Thu, 08 Dec 2011 09:30:54 -0800 (PST) Original-Received: by 10.50.190.167 with HTTP; Thu, 8 Dec 2011 09:30:53 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.41 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:146583 Archived-At: On Wed, Dec 7, 2011 at 3:01 PM, Stefan Monnier wrote: >>> > You are, in fact, saying that fontifying a 60-MByte compilation buffer >>> > creates text properties and other supporting data structures that can >>> > accrue to a total of 2G bytes. I find this extremely hard to believe. >>> > A simple calculation will show that a file that has 1 million lines >>> > with 5 different faces (warning, line number, column number, >>> > underline, default) per line needs only a few million intervals -- how >>> > can this require 2G bytes of memory? > > Because the property values are themselves non-trivial. > >>> Start fresh Emacs instance, make sure you're in *scratch*. Type M-x >>> compilation-minor-mode, then eval (staying in *scratch*, of course): >>> >>> (let ((x 0)) (while (< x 1000000) (insert "test:1:oops\n") (setq x (1+ x)))) >>> >>> Wait for completion, then see RSS. Next, kill *scratch*, M-x garbage-collect >>> and see RSS again. > >> How is this different from compiling a C file with 1000000 #warning >> directives? What am I missing? > > To test your buffer-reallocation theory, you could instead do > > (insert (apply #'concat (make-list 1000000 "test:1:oops\n"))) Again, totally unscientific test without real instruments. On a fresh trunk --with-ns build: paste "(insert (apply #'concat (make-list 1000000 "test:1:oops\n")))" to *scratch* and M-x eval-buffer: from 21.8MB to 55.8MB as this was *scratch*, open ~/.bashrc in another buffer and kill both and it's down to 44.4MB M-x garbage-collect 32.9MB M-x garbage-collect, M-x garbage-collect: 29.2MB