Check runtime system memory leaks

The Genero BDL runtime system can produce a garbadge collection status when a program ends.

To improve the quality of the runtime system, fglrun supports the -M / -m options to count the creation of built-in class objects and some internal objects. This allows you to check for memory leaks in the runtime system: The runtime system counts the object creations and destructions for each class. The right-most column of the output is the difference between created and destroyed objects, it must show a zero for all type of objects.

The options described here are provided for debugging purpose only. The output format is subject to change. These options can also be removed in a next version of the product.

$ fglrun -M stores.42r 
FunctionI        :       10 -      10 =      0 
Module           :        3 -       3 =      0
... 
FieldType        :       19 -      19 =      0

The -M option displays memory counters at the end of the program execution.

The -m option checks for memory leaks, and displays memory counters at the end of the program execution if leaks were found.

Each line shows the number of objects allocated, and the number of objects freed. If the difference is not zero, there is a memory leak.

If you are doing automatic regression tests, we recommend that you run all your programs with fglrun -m to check for memory leaks in the runtime system.