How do I clear a temporary PTR Struct in FORTRAN called my Matlab

1 回表示 (過去 30 日間)
Rick
Rick 2014 年 10 月 7 日
コメント済み: Rick 2014 年 10 月 8 日
I have a Matlab file that is calling a mexed FORTRAN routine.... I need to clear out the temporary structures before it returns to Matlab.
Here is how I am creating the temp structure:
mwPointer tmp_strct
tmp_strct = mxCreateStructureMatrix(m,n,fieldnames)
THen I use it with the mxSetFieldByName and mxDuplicateArray functions to load the outputs of plhs. It works fine.......... However, the reason I ask is because i think its retaining memory....ie.... memory leak. :-(
I sometimes get a low memory window pop-up. I am using Matlab 2012b and intel compiler on Windows. Can this tmp_strct be cleared BEFORE returning to matlab.
Can I aleviate this problem ??

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 10 月 7 日
Rick - try using mxDestroyArray to free the memory allocated by the mxCreateStructureMatrix function.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by