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: Enlarge MAX_ALLOCA? Date: Thu, 19 Jun 2014 14:28:08 -0400 Message-ID: References: <83sin0sx98.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1403202528 1745 80.91.229.3 (19 Jun 2014 18:28:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Jun 2014 18:28:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 19 20:28:38 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wxh4f-0005k0-Kn for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 20:28:37 +0200 Original-Received: from localhost ([::1]:37212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxh4f-0000wC-8h for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 14:28:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxh4V-0000vy-Kk for emacs-devel@gnu.org; Thu, 19 Jun 2014 14:28:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wxh4O-0007HX-6D for emacs-devel@gnu.org; Thu, 19 Jun 2014 14:28:27 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:36577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxh4E-0007FV-Oe; Thu, 19 Jun 2014 14:28:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd+D9/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOI1cHhDgEoyqFb4Fqg0whgS0 X-IPAS-Result: ArUGAIDvNVNLd+D9/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOI1cHhDgEoyqFb4Fqg0whgS0 X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="68350055" Original-Received: from 75-119-224-253.dsl.teksavvy.com (HELO pastel.home) ([75.119.224.253]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 19 Jun 2014 14:28:09 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 5828660D16; Thu, 19 Jun 2014 14:28:08 -0400 (EDT) In-Reply-To: <83sin0sx98.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 19 Jun 2014 19:02:43 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:172542 Archived-At: > Does anyone see problems with the change below, which raises the bar > for 'alloca' to 64KB? Are there any systems out there that we care > about whose stack is so small as to make this dangerous? It makes the potential max increment of stack space "per lisp-eval-depth" larger, and hence increases the risk that we'll eat up our stack before we bump into max-lisp-eval-depth. The idea behind the 16KB limit is that the cost of malloc+free is likely to be negligible compared the filling and using 16KB of data. > Why 64KB? Because that's the size of the work area coding.c allocates > whenever it needs to encode or decode something. It turns out we do > this a lot, e.g., every redisplay calls file-readable-p on the icon > image files, which needs to encode the file name. While the work area > is immediately free'd, I think allocating such a large buffer so much > has a potential of creating an unnecessary memory pressure on 'malloc', > and perhaps cause excess fragmentation and/or enlarge memory footprint > in some cases. I think it makes a lot of sense to try and allocate this space on the stack when decoding file names, but why does it allocate such a huge buffer just to en/decode a puny file name? If the malloc/free done for this encode/decode is relatively costly, maybe it's because we allocate too much space compared to what we use. Stefan