Ar an triú lá de mí Feabhra, scríobh Julian Bradfield:
>Julian Bradfield <jcb+xeb(a)jcbradfield.org> writes:
>> As usual when I try to do anything, I find I really don't quite
>> understand GC and when GCPRO is necessary.
I felt like this for years, and now I don’t any more, mainly because I
committed a few patches where things got garbage-collected that shouldn’t
have been, and it wasn’t always my mistake. Cf. this and the related thread:
The #'reduce bug here *was* my mistake, though:
It’s difficult to get GCPRO right all the time, but understanding when one
should GCPRO is not that difficult.
>Did you look at the section on garbage collection in the
>manual? In particular, there's a subsection on GCPRO.
Yes...but I should have read the Invocation section more carefully.
>> concat() in fns.c GCPROs its arguments, to be helpful to the caller.
>> What is it that concat() does that could cause a GC or QUIT?
>It allocates. If there's not enough free space in the heap to satisfy
>an allocation, a GC is triggered.
The manual clearly says "this is _not_ the case".
Right. Feval(), Ffuncall() are what to worry about. The CHECK_STRING() etc.
macros are less of an issue now, they used to signal continuable errors, but
now they’re non-continuable, so you won’t get past that line of the C code
with some memory you’ve just allocated having disappeared. But the various
code that calls wrong_type_argument () in emulation of the continuable
behaviour will shoot you in the foot.
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
XEmacs-Beta mailing list