From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#30626: 26.0.91; Crash when traversing a `stream-of-directory-files' Date: Fri, 02 Mar 2018 09:11:46 -0500 Message-ID: <87606e4lel.fsf@gmail.com> References: <87inaiss6l.fsf@web.de> <6FCF6ACA-4F29-4B6B-BE9D-D7130C6E9495@gnu.org> <87fu5moe4c.fsf@web.de> <877eqyocro.fsf@web.de> <83zi3uz4nb.fsf@gnu.org> <87lgfd52by.fsf@gmail.com> <87bmg91ity.fsf@web.de> <83h8q1yuin.fsf@gnu.org> <87po4pnl0a.fsf@web.de> <837eqxyqoe.fsf@gnu.org> <87lgfdnf86.fsf@web.de> <87muzs11hk.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1520000322 27472 195.159.176.226 (2 Mar 2018 14:18:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Mar 2018 14:18:42 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: Nicolas Petton , 30626@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 02 15:18:37 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1erlW8-0006LA-8U for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Mar 2018 15:18:36 +0100 Original-Received: from localhost ([::1]:35335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erlY9-00052G-Pu for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Mar 2018 09:20:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erlPq-0006mI-Dl for bug-gnu-emacs@gnu.org; Fri, 02 Mar 2018 09:12:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erlPm-0002oI-EV for bug-gnu-emacs@gnu.org; Fri, 02 Mar 2018 09:12:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60649) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erlPm-0002oC-AO for bug-gnu-emacs@gnu.org; Fri, 02 Mar 2018 09:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1erlPm-0001Pb-4R for bug-gnu-emacs@gnu.org; Fri, 02 Mar 2018 09:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Mar 2018 14:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30626 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30626-submit@debbugs.gnu.org id=B30626.15199999155407 (code B ref 30626); Fri, 02 Mar 2018 14:12:02 +0000 Original-Received: (at 30626) by debbugs.gnu.org; 2 Mar 2018 14:11:55 +0000 Original-Received: from localhost ([127.0.0.1]:40312 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1erlPe-0001P9-Nj for submit@debbugs.gnu.org; Fri, 02 Mar 2018 09:11:54 -0500 Original-Received: from mail-it0-f50.google.com ([209.85.214.50]:34644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1erlPd-0001Ov-LI for 30626@debbugs.gnu.org; Fri, 02 Mar 2018 09:11:53 -0500 Original-Received: by mail-it0-f50.google.com with SMTP id n128so2142822ith.1 for <30626@debbugs.gnu.org>; Fri, 02 Mar 2018 06:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=lHPt3axmMeemcCSiyLyeUQOwJu9A0/wp1ogB44e7ADI=; b=IW0X5TM/sgI/QKtfdFXTIAwYtgZSDsDiH2YLm7vbJyUG4Dv5dR0GT8v3AyXcggTl3s hTWwv0q5zXkl0Bq7olytpv5laQPwt7AA7pxacNZherNnSfFUuhOX6bAG2kcqTjiswrtC 8Tto1DNxMudPXBev4Loet2ADuP1grhE+5p2H2OhVhTOZkJRhS9FwSTkxYvhjcuxBKvr9 Txa4Z/6g2Jttb3TW3GKHM3V6zTtvT0dE8yG3uZXCvYdKzYWfw2ECh/cSK8uReVN13VYr /MSGWPB+m+2YPzr/L/Zj5AvGg2WN7gPSlYPsnwSdg73SmGeMwkXEgpUHvf/eqGOa02Et beeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=lHPt3axmMeemcCSiyLyeUQOwJu9A0/wp1ogB44e7ADI=; b=B4w/fMOuHWEd8xQRp5Xma7xk6xzMpq2wkx2t+9drEmK9RveUImQ98gVmi5+WFLHCGx BNfiTqZS28AJAmN8nh0BlA0Inka3EJtSN8+X2QJXoYAj2ggFvdnRSd5SsPL78Cna24Om f0hU7G518BIrfhBl7k18+I+n27Q19ImRxEDXBgxFmegb5besIvb6Cv5YHwwj0HCJ3G43 /UgYqxvKKTDYantx9KOiF7+zlyCb7LSx8fl/ULB0lp87mlQGDu1jyEE377v5bV7wWp70 aDgG6t43dpyW3LyK3NEPkvUTaKoA3QrJn9BisADIMJkNSQxPmybldOIcO40uM4zeULcm gh7g== X-Gm-Message-State: AElRT7GJf3T7noOUBTjwgizokdKjK9UN07E87j2ZrK2YnRLdq9fk19P1 YTqSr/nSysWh6r37u6yvuLw= X-Google-Smtp-Source: AG47ELuKUlUGdjpbtSYPJin2WtBpXrPwFiH+KAuB7HTF5w1n1iT5engUK1YWokS+rRI6lmeOuGO+gQ== X-Received: by 10.36.55.70 with SMTP id r67mr2688149itr.40.1519999907945; Fri, 02 Mar 2018 06:11:47 -0800 (PST) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 12sm875293itm.1.2018.03.02.06.11.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Mar 2018 06:11:47 -0800 (PST) In-Reply-To: <87muzs11hk.fsf@web.de> (Michael Heerdegen's message of "Thu, 01 Mar 2018 12:25:43 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143839 Archived-At: Michael Heerdegen writes: > #+begin_src emacs-lisp > ;; -*- lexical-binding: t -*- > > (require 'stream) > > (let ((stream (stream-range 1 1000000))) > (while (not (stream-empty-p stream)) > (cl-callf stream-rest stream))) > #+end_src > > This is semantically exactly like test2.el, only the call to > `stream-flush' has been replaced by literally writing out the > definition. Nonetheless, the compiled file suddenly doesn't crash Emacs > when loaded. Loading the uncompiled file test3.el still crashes. Aha, but the following also crashes, whether compiled or not: ;; -*- lexical-binding: t -*- (require 'stream) (let* ((stream0 (stream-range 1 1000000)) (stream stream0)) (while (not (stream-empty-p stream)) (cl-callf stream-rest stream))) So the problem is that the initial stream0 object can reach the entire unfolding stream as it goes, and just holding on to that reference is enough to keep the whole thing in memory. Now, I can see that letting stream0 automagically get access to the unfolded result can be an optimization in some cases, although in this case it's a pessimization. It could also affect the semantics if unfolding the stream has side effects, not sure if stream.el makes guarantees about that though.