pyCleanup function

void pyCleanup()

Cleans up the memory of the loaded modules

Implementation

void pyCleanup() {
  if (pyErrOccurred()) {
    print('Exited with python error:');
    dartpyc.PyErr_Print();
  }
  for (final mod in List.of(_moduleMap.values)) {
    mod.dispose();
  }
  dartpyc.Py_FinalizeEx();
  if (_pprogramLoc == nullptr) {
    malloc.free(_pprogramLoc);
  }
  if (_pathString == nullptr) {
    malloc.free(_pathString);
  }
}