From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Avoid C stack overflow Date: Sat, 15 Mar 2014 10:38:05 +0900 Message-ID: <87iorgkzr6.fsf@uwakimon.sk.tsukuba.ac.jp> References: <5321E00C.2010107@yandex.ru> <5321F18D.5080008@cs.ucla.edu> <532297FB.7090608@yandex.ru> <5322A8DE.3080109@cs.ucla.edu> <53230AA9.6030005@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1394847497 9623 80.91.229.3 (15 Mar 2014 01:38:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Mar 2014 01:38:17 +0000 (UTC) Cc: Paul Eggert , Dmitry Antipov , Emacs development discussions To: Stefan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 15 02:38:25 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 1WOdYP-0007Nv-OL for ged-emacs-devel@m.gmane.org; Sat, 15 Mar 2014 02:38:25 +0100 Original-Received: from localhost ([::1]:48088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOdYP-0002VW-Ci for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2014 21:38:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOdYG-0002UW-1N for emacs-devel@gnu.org; Fri, 14 Mar 2014 21:38:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOdY8-0002Ko-NW for emacs-devel@gnu.org; Fri, 14 Mar 2014 21:38:15 -0400 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:56870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOdY8-0002Jz-DR for emacs-devel@gnu.org; Fri, 14 Mar 2014 21:38:08 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 00563970945; Sat, 15 Mar 2014 10:38:05 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id E0FCF1A28DC; Sat, 15 Mar 2014 10:38:05 +0900 (JST) In-Reply-To: X-Mailer: VM undefined under 21.5 (beta34) "kale" 2a0f42961ed4 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 130.158.97.224 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:170372 Archived-At: Stefan writes: > > Emacs already has a stack-overflow prevention mechanism, right? > > Yes. > > > And we're talking about what to do when the user deliberately disables > > it? So the simplest answer is "don't do that". > > Actually, when we bump into something like max-lisp-eval-depth, we > could look at the actual C stack size to compute the average "C stack Surely you want a worst-case-experienced-in-practice estimate here. So you should collect data on *variation* of the ratio of C stack size to max-lisp-eval-depth as well. N.B. Unless the stack is extremely well-behaved across Lisp programs, you're computing max-lisp-eval-depth to stack size for the case where you hit max-lisp-eval-depth. It might very well be that this is quite different from cases where you don't. I don't know if this *matters* in any practical application to Emacs development, probably not. But I don't know what other uses people might find for this statistic. > usage per Lisp eval depth" and from that compute a approximate upper > bound on the maximum safe value of max-lisp-eval-depth.