HALCON provides a sophisticated memory management not only to handle iconic objects, but also to allocate/deallocate arbitrary data. Please use the corresponding HALCON Extension Package Interface routines exclusively. Do not create/destroy memory blocks on the heap with the standard routines of the operating system (like malloc and free) since the HALCON routines provide a caching mechanism, garbage collection for temporary data, and debugging facilities.
We strongly recommend not to use global variables within HALCON operators. If they are not avoidable at least make them static within the file of usage. If even this is undesirable group them into structures to keep the number of global names small.
If you use static variables, be aware that they are shared between multiple threads. Please note, that HALCON uses multithreading to exploit multi-processor or multi-core hardware. This means, that multiple instances of your code will actually share all the static variables! Furthermore, be aware that large static arrays consume a lot of memory – keep in mind that HALCON is a very large system enfolding hundreds of operators.