Consider the compound expression in the following statement:
debugwritestring("A: " ; cast(string, a) ; " B: " ; cast(string, b) ; " C: " ;
cast(string, c))
If the garbage collector ticks over at the right time (say, after the call to
cast b to a string) it will collect the temporary string objects being created
as part of the expression, without properly noting that they are in use.
This is due to a limitation in the current garbage collector, wherein the stack
is not fully examined - only local variables and registers and
freestore-allocated structures. Temporary values on the stack are ignored,
mainly because of a lack of type annotations indicating how to *interpret*
stack values.
For example, consider the stack with two booleans, an int16, and an integer,
which happen to map out to values that correspond to string handles. Should we
flag those handles as in-use on the off-chance that the stack values correspond
to strings? Or do we need type annotations someplace that will tell us to
ignore all the values involved?
This will need to be carefully considered for a proper solution.
Original issue reported on code.google.com by don.ap...@gmail.com on 17 Dec 2010 at 9:42
Original issue reported on code.google.com by
don.ap...@gmail.com
on 17 Dec 2010 at 9:42