From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Building Emacs overflowed pure space Date: Tue, 18 Jul 2006 16:56:36 -0400 Message-ID: References: <7dbe73ed0607180138x35e9d9bft3e42f20cb369795c@mail.gmail.com> <200607181855.k6IItgAV027751@jane.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1153256213 18277 80.91.229.2 (18 Jul 2006 20:56:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Jul 2006 20:56:53 +0000 (UTC) Cc: mathias.dahl@gmail.com, Luc Teirlinck , rms@gnu.org, ralphm@members.fsf.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 18 22:56:52 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G2wcc-0006op-He for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2006 22:56:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2wcc-0005s4-1Z for ged-emacs-devel@m.gmane.org; Tue, 18 Jul 2006 16:56:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G2wcQ-0005ri-Jp for emacs-devel@gnu.org; Tue, 18 Jul 2006 16:56:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G2wcO-0005rF-Rc for emacs-devel@gnu.org; Tue, 18 Jul 2006 16:56:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2wcO-0005rC-PE for emacs-devel@gnu.org; Tue, 18 Jul 2006 16:56:36 -0400 Original-Received: from [209.226.175.74] (helo=tomts20-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G2wfJ-0002OL-CE; Tue, 18 Jul 2006 16:59:37 -0400 Original-Received: from localhost ([70.53.192.251]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060718205632.DAEJ16051.tomts20-srv.bellnexxia.net@localhost>; Tue, 18 Jul 2006 16:56:32 -0400 Original-Received: by localhost (Postfix, from userid 20848) id 75C196C348; Tue, 18 Jul 2006 16:56:36 -0400 (EDT) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Tue, 18 Jul 2006 23:16:25 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57287 Archived-At: > I don't think it's reasonable at this stage. We are not supposed to > install changes that increase the pure size significantly; adding 10K > will just risk wasting memory in the released Emacs. I'm not sure what size other people get, but my `emacs' binary is never smaller than 2MB (by a long shot), so even if one counts the worst case 20KB of wasted space (10KB * 2 (64bit growth factor)), it's still less than 1%. Not much to worry about. If we really care about that kind of memory, we can do as XEmacs did: dump once to see how much pure space is necessary, than adjust pure size and redump. I use here a local hack which saves more pure space than that by simply using a more compact representation for strings. I haven't installed it because I'm not convinced it's worth the trouble (it's more interesting on 64bit systems, tho). See patch hunk below to get a feel for it ;-) Stefan --- orig/src/lisp.h +++ mod/src/lisp.h @@ -709,14 +736,24 @@ /* Set text properties. */ #define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT)) +/* If the string's size is smaller than the size of a pointer, + we store the data directly in Lisp_String, otherwise, we store it in + a separate object. */ +#define STRING_MAXINLINE (sizeof (unsigned char *)) + /* In a string or vector, the sign bit of the `size' is the gc mark bit */ struct Lisp_String { EMACS_INT size; - EMACS_INT size_byte; + EMACS_INT size_byte : BITS_PER_EMACS_INT - 1; + unsigned inlined : 1; /* 0 -> ptr, 1 -> chars; in union below. */ INTERVAL intervals; /* text properties in this string */ - unsigned char *data; + union + { + unsigned char *ptr; + unsigned char chars[STRING_MAXINLINE]; + } data; }; #ifdef offsetof