[Editor] Data table instance issues

  1. [Trigger editor] DataTableInstanceValueName definition lacks return type. It should return string, instead of void.
  2. [Trigger editor] DataTableInstanceGetUnitRef has incorrect macro definition.
    Currently it is:
    UnitRefToUnit(DataTableInstanceGetUnitRef(#PARAM(scope), #PARAM(name)))
    While it should be:
    UnitRefToUnit(DataTableInstanceGetUnitRef(#PARAM(instance), #PARAM(name)))
  3. It seems it’s impossible to destroy previously created datatable instance. DataTableInstanceDestroy function is missing.
  4. Data table instance is leaking memory. Tested with following code:
void datatable_test()
    int i;
    int dti;

    for (i = 0; i < 1000000; i += 1) {
        dti = DataTableInstanceLastCreated();
        DataTableInstanceSetString(dti, "k" + IntToString(i), "v");

It allocates over 500MB which is never reclaimed (once we quit the sc2map). Restarting the same map multiple times will ultimately lead to Core: out of memory crash.