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 object creations and destructions for each internal 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.

Note: 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.

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.

Note: The fglrun -M and -m options are exclusive.

The -M option displays memory counters at the end of the program execution. Counters are displayed, even if there are no memory leaks:

$ fglrun -M stores.42r 
Dialog           :       10 -      10 =      0 
Window           :       12 -      12 =      0 
Module           :        3 -       3 =      0
...

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

$ fglrun -m stores.42r 
Dialog           :       10 -      10 =      0 
Window           :       12 -      12 =      0 
Module           :        3 -       3 =      0
... 
MyString         :      219 -     218 =      1                 <--- leak!
...