|
From: | Anders Lindgren |
Subject: | bug#16576: Binding `standard-output' to a function doesn't work -- function sometimes called with garbage |
Date: | Wed, 29 Jan 2014 22:12:29 +0100 |
> Date: Tue, 28 Jan 2014 23:00:32 +0100
> Well, the main issue here is if this is a real bug or not. You originallyThere was indeed a bug, now fixed on the trunk, which caused the
> thought this was simply a mistake in the example I provided -- do you still
> think so?
problem. It was a very old bug, it went unnoticed until now because,
I guess, no one conses a string one character at a time -- this is a
terrible idea in Emacs Lisp. Use a temporary buffer instead.
There was nothing wrong with prin1 per se, btw, it's just that its
subroutine which prints a string wasn't safe when GC hit in the middle
of a prin1 call. The code protected the string from GC, but that
doesn't preclude relocation of string data, so holding to C 'char *'
pointers is not safe in these situations. And printing a
800-character string like you did triggers GC every time, because it
creates 800 string objects for a grand total of about 320000 bytes.
Anyway, problem solved, and I'm closing the bug. Thanks.
[Prev in Thread] | Current Thread | [Next in Thread] |