move mxFree into the compilation unit that allocates memory