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: Enlarge MAX_ALLOCA? Date: Thu, 19 Jun 2014 21:38:40 +0300 Message-ID: <83lhsssq1b.fsf@gnu.org> References: <83sin0sx98.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1403203161 8987 80.91.229.3 (19 Jun 2014 18:39:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Jun 2014 18:39:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier , Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 19 20:39:11 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 1WxhEr-00037I-IW for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 20:39:09 +0200 Original-Received: from localhost ([::1]:37236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxhEr-0002Lj-70 for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 14:39:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxhEj-0002LR-Kc for emacs-devel@gnu.org; Thu, 19 Jun 2014 14:39:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxhEe-0002Yn-Fz for emacs-devel@gnu.org; Thu, 19 Jun 2014 14:39:01 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:58242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxhEe-0002Yh-7a; Thu, 19 Jun 2014 14:38:56 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0N7F00H00I4BZZ00@a-mtaout20.012.net.il>; Thu, 19 Jun 2014 21:38:54 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7F00HMKIGURG50@a-mtaout20.012.net.il>; Thu, 19 Jun 2014 21:38:54 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 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:172543 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Thu, 19 Jun 2014 14:28:08 -0400 > > > 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. Which functions relevant to max-lisp-eval-depth use SAFE_ALLOCA? > 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. I'm talking about the long-run costs, not the immediate ones. > 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? That buffer is fixed in size, I don't know what. Perhaps it's hard to know in advance how much we will need. I hope Handa-san could explain. > 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. Again, the problem is memory fragmentation and the resulting large footprint, not the cost of the allocation.