3 Finalization is a way for the C primitives to release resources back to the system.
5 Rather than having a very complex system where any object can be finalized,
6 I have decided to centralize finalization in one class. This makes handling it in
7 the garbage collector very efficient.
9 Any class that needs finalizable data should create and point to an instance of
10 this class and put the data into it. This should be done from a primitive.
11 When the garbage collector collects this object it will call the C function you
12 stored in cFunction with this object as the parameter. You can also call the
13 finalize method to finalize on demand.
15 You should put your C function pointer into cFunction, and the finalizable object into 'object'.
20 var cFunction, object; // no getters or setters!
22 // no *new method! Create in a primitive.
24 //finalize { _Finalize }
25 notFinalized { ^cFunction.notNil }
26 isFinalized { ^cFunction.isNil }