Freegroup
This instruction frees the memory of an instance and all the instances sharing the same allocation group.
FreeGroup INSTANCE_VAR
See [allocgrp](../4gl/allocgrp.md) and [NewInstance](../4gl/newinstance.md) for more information on instance allocation and allocation groups.# Declare two instancesLocal Instance MY_CUSTOMER Using C_CUSTOMERLocal Instance MY_SALESREP Using C_SALESREPLocal Instance MY_COUNTRY Using C_COUNTRY# Allocate both instances in the same allocation groupMY_CUSTOMER = NewInstance C_CUSTOMER AllocGroup NullMY_SALESREP = NewInstance C_SALESREP AllocGroup MY_CUSTOMERMY_SALESREP = NewInstance C_SALESREP AllocGroup MY_CUSTOMERMY_COUNTRY = NewInstance C_COUNTRY AllocGroup MY_SALESREP...# Free only the country instanceFreeInstance MY_COUNTRY : # MY_CUSTOMER and MY_SALESREP still allocated# Free the allocation group (this would have freed MYCOUNTRY also if it had not already been done)FreeGroup MY_CUSTOMER : # FreeGroup MY_SALESREP would have the same effect
Local Instance MY_CUSTOMER Using C_CUSTOMERMY_CUSTOMER=NewInstance C_CUSTOMER AllocGroup Null...FreeGroup MY_CUSTOMERMY_CUSTOMER=null
Structure, Instance, SetInstance, NewInstance, null, allocgrp, cast, FreeInstance.