unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el]
Date: Tue, 13 Dec 2005 17:27:04 -0500	[thread overview]
Message-ID: <87bqzkiqfb.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1EjRqy-0008Qs-E5@fencepost.gnu.org> (Richard M. Stallman's message of "Mon, 05 Dec 2005 20:42:48 -0500")

"Richard M. Stallman" <rms@gnu.org> writes:

>     I reproduced the error and also found that Emacs hangs in the built-in
>     function `prin1-to-string' when it tries to print the value the
>     function `widget-create' returns, which contains a lot of circular
>     references in a deeply nested list.  If I don't interrupt the hang,
>     after some time, the function fails with a "Memory exhausted" message.
>     Notice that the widgets are correctly created in the "*Open Recent*"
>     buffer.  This is only the edebug prin1 function that hangs.
>
>     When I set the value of `edebug-print-level' to 10 instead of the
>     default value of 50, Emacs no more hangs.
>
>     Maybe there is a bug in the prin1-to-string function?  Unfortunately I
>     don't know how to fix it.
>
> Can someone investigate that bug?  David Ponce said he can't.

I think the trouble is that the way print_preprocess "follows" nested
lists, while handling print_depth, is slightly different from the way
print_object does it.  Because of this, it is possible for
print_preprocess to give up sooner than print_object would.  An object
could thus fail to be put into Vprint_number_table, even though
print_object later is later called for it.

There is a quick but inelegant way to cover up this bug:

*** emacs/src/print.c.~1.214.~	2005-11-10 08:45:06.000000000 -0500
--- emacs/src/print.c	2005-12-13 17:17:49.000000000 -0500
***************
*** 1313,1319 ****
  
    /* Give up if we go so deep that print_object will get an error.  */
    /* See similar code in print_object.  */
!   if (print_depth >= PRINT_CIRCLE)
      return;
  
    /* Avoid infinite recursion for circular nested structure
--- 1313,1319 ----
  
    /* Give up if we go so deep that print_object will get an error.  */
    /* See similar code in print_object.  */
!   if (print_depth > 2 * PRINT_CIRCLE)
      return;
  
    /* Avoid infinite recursion for circular nested structure

  reply	other threads:[~2005-12-13 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-21  9:34 [Stephen.Berman@gmx.net: Emacs hangs while edebugging recentf.el] David PONCE
2005-11-28  4:47 ` Richard M. Stallman
2005-12-06  1:42 ` Richard M. Stallman
2005-12-13 22:27   ` Chong Yidong [this message]
2005-12-14 20:04     ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2005-11-28  8:19 David PONCE
2005-11-29  3:11 ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bqzkiqfb.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).