11 Scan Object Library

This Library contains support for scanning all objects at a point of time in the execution of any BETA program.

The main pattern is "scanPrefix:"

scanPrefix:
  (# callback:< scanCallback;
     root: ##object;
     printVisited,printOrigin,printSize: @boolean;
  do INNER
  #);
If you specialize the 'callback' virtual, it will be executed once for each object visited, with 'obj' referring to the object being visited. It will never be executed for a non-object, such as a repetition etc.

The pattern variable 'root' is used to select which objects to visit: an object is visited iff it is an instance of a specialization of the pattern denoted by 'root'. If 'root' is NONE, all objects and non-objects are visited. If (root## = object##), all objects are visited.

If 'printVisited' is true, a message is printed describing the pattern of each visited object, and giving the category of each visited non-object, such as '[Value Repetition]'.

When 'printVisited' is true, other booleans can be used to enhance the output for objects: If 'printOrigin' is true, the origin of each visited object is printed. If 'printSize' is true, the size in bytes of each visited object is printed.

If a garbage collection runs during a scan, it will be aborted with an error message, but the program continues otherwise unaffected. To avoid this, try to create as few objects as possible in callback. (If callback is not specialized, it will not get called, and no objects will be created during the scan.)


System Utilities - Reference Manual
© 1994-2002 Mjølner Informatics
[Modified: Friday September 29th 2000 at 23:36]