The compiler should generate deinitializer functions which unprotects aterms which are
protected by the initializer functions. This is needed to avoid garbage collection
problems when dynamically loaded modules are unloaded.

For example, given the initializer

 static void init_module_constructors (void)
 {
   sym_Orange_1 = ATmakeSymbol("Orange", 1, ATfalse);
   ATprotectSymbol(sym_Orange_1);
   sym_Nil_0 = ATmakeSymbol("Nil", 0, ATfalse);
   ATprotectSymbol(sym_Nil_0);
 }

there should be a matching deinitializer:

 static void deinit_module_constructors (void)
 {
   ATunprotectSymbol(sym_Orange_1);
   ATunprotectSymbol(sym_Nil_0);
 }

Submitted on 25 July 2005 at 10:11

On 28 January 2013 at 14:46 Eelco Visser removed tag 0.18M1

On 28 January 2013 at 14:46 Eelco Visser tagged interesting

Log in to post comments