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 19:48:06 +0300 Message-ID: <83r42ksv5l.fsf@gnu.org> References: <83sin0sx98.fsf@gnu.org> <87bnto98ch.fsf@fencepost.gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1403196537 24654 80.91.229.3 (19 Jun 2014 16:48:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Jun 2014 16:48:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 19 18:48:48 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 1WxfW2-0000jB-Jl for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 18:48:46 +0200 Original-Received: from localhost ([::1]:36742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxfW2-0002RH-6y for ged-emacs-devel@m.gmane.org; Thu, 19 Jun 2014 12:48:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxfVt-0002R5-68 for emacs-devel@gnu.org; Thu, 19 Jun 2014 12:48:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxfVm-0004eF-G7 for emacs-devel@gnu.org; Thu, 19 Jun 2014 12:48:36 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:63486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxfVf-0004Vs-DM; Thu, 19 Jun 2014 12:48:23 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N7F00F00D5UC500@a-mtaout22.012.net.il>; Thu, 19 Jun 2014 19:48:21 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7F00FVDDCL8K30@a-mtaout22.012.net.il>; Thu, 19 Jun 2014 19:48:21 +0300 (IDT) In-reply-to: <87bnto98ch.fsf@fencepost.gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 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:172536 Archived-At: > From: David Kastrup > Date: Thu, 19 Jun 2014 18:23:26 +0200 > > Eli Zaretskii writes: > > > -#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA \ > > +#define SAFE_ALLOCA(size) ((size) <= MAX_ALLOCA \ > > ? alloca (size) \ > > : (sa_must_free = true, record_xmalloc (size))) > > > > @@ -4469,7 +4469,7 @@ extern void *record_xmalloc (size_t) ATT > > > > #define SAFE_ALLOCA_LISP(buf, nelt) \ > > do { \ > > - if ((nelt) < MAX_ALLOCA / word_size) \ > > + if ((nelt) <= MAX_ALLOCA / word_size) \ > > (buf) = alloca ((nelt) * word_size); \ > > else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \ > > { \ > > Bad idea to change < to <= here. The original macros were inconsistent: some used < and some <=, so I changed them. > If there is a hard limit due to short offsets or similar (and if > there weren't, why bother at all?), then allocating a full 64kB > might be a bad idea. Is there really such a system? If so, which one? And why would that be a worse idea than to allocate the same 64KB off the heap (which is what that macro does in the 'else' clause? What am I missing? > 64kB feels arbitrary. I explained my rationale for choosing this value.