Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mat73 file handle release on Mat_VarRead() #44

Closed
cstaub opened this issue Sep 7, 2016 · 4 comments
Closed

Mat73 file handle release on Mat_VarRead() #44

cstaub opened this issue Sep 7, 2016 · 4 comments

Comments

@cstaub
Copy link

cstaub commented Sep 7, 2016

Hi,

I'm facing an issue when reading matlab files of version 7.3 with Mat_VarRead(...). Although the file is closed, it cannot be deleted as the process still keeps a reference to the file. Simply calling Mat_VarReadInfo() works fine.

Example:

mat_t* matfp = Mat_Open("C:/temp/test/matlab.mat", MAT_ACC_RDONLY);

// matvar_t* matvar = Mat_VarReadInfo(matfp, "Name"); // -> works fine, file handle is released
matvar_t* matvar = Mat_VarRead(matfp, "name"); // -> fails -> file handle not released after Mat_Close()

Mat_VarPrint(matvar, 1);

Mat_VarFree(matvar);
Mat_Close(matfp);

Environment is windows 7, 64bit, visual studio 2012, hdf4-lib version 1.10.0-patch1. No issues when using matlab v4.0 format.

Can you please investigate and confirm. Thank you for your support.
cstaub

@tbeu
Copy link
Owner

tbeu commented Sep 8, 2016

Does it happen with any MAT file of vs 7.3? Can you provide your test file?

@cstaub
Copy link
Author

cstaub commented Sep 12, 2016

No, the issue seems to be related to files written with matio. When reading files that have been previously written using matlab, the handle is released. Please find an example file attached, which in my case keeps the file handle open.

ReadWriteArray.zip

@tbeu
Copy link
Owner

tbeu commented Sep 13, 2016

Thanks. Can reproduce the issue.

tbeu added a commit that referenced this issue Sep 13, 2016
@tbeu
Copy link
Owner

tbeu commented Sep 13, 2016

Resolved by 38f50fd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants