Subject: bug#30626: 26.0.91; Crash when traversing a `stream-of-directory-files'

From: Eli Zaretskii <[email-masked]>
Date: Fri, 02 Mar 2018 17:43:27 +0200

> From: Michael Heerdegen <[email-masked]>
> Date: Fri, 02 Mar 2018 16:06:49 +0100
> Cc: Nicolas Petton <[email-masked]>, [email-masked]
> 
> > (let* ((stream0 (stream-range 1 1000000))
> >        (stream stream0))
> >   (while (not (stream-empty-p stream))
> >     (cl-callf stream-rest stream)))
> 
> I guess you should have some awe if you write something like
> (stream-range 1 1000000) and keep in mind what happens with this
> gigantic thing.  Though, could the object `stream0' references not
> already be garbage-collected when the loop has been entered, since there
> is no lexical reference to that variable there?

It's still referenced by the let* form, I think.

But even if it didn't, you cannot rely on it being GC'ed, because
Emacs triggers GC at times which are hard or even impossible to
predict.