In MATLAB 7.3 (R2006b), the documentation for the MATLAB Engine API function "engGetVariable" reads:
engGetVariable reads the named mxArray from the MATLAB engine session associated with ep and returns a pointer to a newly allocated mxArray structure, or NULL if the attempt fails. engGetVariable fails if the named variable does not exist. Be careful in your code to free the mxArray created by this routine when you are finished with it.
The last line, in saying "free the mxArray", suggests to use "mxFree". More often, the proper way to free the memory is with "mxDestroyArray".
Best Answer