[gambit-list] mutating constant data (Re: strange mutation problem (bug?))

Christian christian at pflanze.mine.nu
Fri Sep 29 05:10:05 EDT 2006


I wrote:
>Replace all quoted #(..) with (vector ..)

Marc:

 From my experience with compile-file, Gambit is "copying" (or maybe 
rather constructing) data from constant definitions upon startup, 
with the nice benefit that it behaves like in the interpreter (e.g. 
insensitive to mutation).

My guess is that Gambit is still doing the same in static binaries, 
but the copied/constructed data is allocated as ___PERM objects; thus 
storing non-immediate objects into them will not segfault right away, 
but the latter are not seen anymore by the GC, and hence when 
accessing the data after the next collection then points into 
undefined places in memory.

Do you think it would be feasible to make mutating accessors throw an 
error in safe mode if their argument is a ___PERM object? (Or maybe 
it's cheaper to just use normal allocations?) I think I'm aware of 
the implications myself and won't write code which defines and 
mutates such data, but I may run into such issues again when working 
with other programmers (where one doesn't always realize the intents 
of the others).

Christian.



More information about the Gambit-list mailing list