[Oberon] Is it really necessary to hide the list of open file descriptors from the GC?

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Mon Feb 14 07:21:56 CET 2022

This question has in the meantime been answered.

Answer: With the way Files is currently implemented, it *is* necessary to hide the list from the garbage collector (GC).

The reason is that in the experiment described in the last post, the mark phase of the GC would of course always mark *all* elements in the list rooted in Files.root - no matter what. Because elements of this list are in fact never removed (except during garbage collection via Files.RestoreList).

(PS: An alternative scheme would be to introduce a reference counter f.refcnt, which is increased in Files.Old and decreased in Files.Close, which would in addition remove a file descriptor from the list if the counter reaches 0. But that would make things more complicated).

More information about the Oberon mailing list