Hi, [EMAIL PROTECTED] (Ludovic Courtès) writes:
> This interleaving of initialization and sweeping makes it pretty hard to > track exactly where fresh cells come from. I guess one solution might > be to maintain a list of the uninitialized segments and pick cells > directly from there before actually sweeping. Thinking about it, this solution looks like the beginning of the generational approach to GC: we'd define uninitialized segments (i.e., those whose FIRST_TIME field is true) as one generation, and the others as another generation. I think we could even have 3 segment generations: 1. The kids, i.e., the uninitialized segments; 2. The youngsters, i.e., segments recently initialized and where sweeping gave good results in the past; 3. The elderly, i.e., those for which sweeping has been unproductive for some time already. Remarks: * This is a very coarse approach to generational GC as it's done on a per-segment basis. For this reason, it doesn't make sense to have more that 3 generations (due to fragmentation, each segment may include a variety of kids, youngsters, and elderly). Even 3 generations (instead of just 2) is a questionable approach. OTOH, even though there is fragmentation, I think it's reasonable to assume that some segments, those created and populated at startup time, will actually only contain elderly cells, whereas segments initialized during the life time of the program (especially for long-running or interactive applications) may be more fragmented and may be considered as "young". Hence the intermediary generation. Additionally, I'm assuming that elderly segments cannot move back to the "youngsters" generation, which seems to be generally assumed in generational GC. * This poor man's generational GC has the advantage of being quite easy to implement. Basically, instead of having a single segment table as we have now, we'd have to maintain a set of three segment tables, which would not be too complicated it seems. In particular, it's much easier to implement than the per-cell generational GC, as proposed by Greg Harvey in http://home.thezone.net/~gharvey/guile/ggc-notes.txt . It's also less intrusive: basically `scm_i_sweep_some_segments ()' is the only place where generations would be taken into account. Of course, the outcome would certainly be better with a per-cell approach, but I'd expect the per-segment approach to yield a non-null benefit for a pretty low cost. What do you think? Are there flaws in this reasoning? :-) Thanks, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel