double free or corruption (out) error when using MATLAB Runtime 2023b

59 views (last 30 days)
I can not add an example of my code below because it is in a closed space, however I've been able to isolate the issue.
While using matlab runtime 2023b with python, I am importing my own .ctf file. After about 2000 calls of the eigs() function in matlab I eventually receive a "double free or corruption (out) MATLAB is exiting because of the fatal error." I've never received this error when simply just using matlab with the same code base. So my theory is that there's something wrong with MATLAB Runtime. Has anyone ruin into this? Does anyone have any advice on what I could possibily try next?
  2 Comments
dpb
dpb on 16 Aug 2025
"...my theory is that there's something wrong with MATLAB Runtime"
Not necessarily, in fact, if the MATLAB-only code doesn't exhibit the problem, it would eliminate it being the source.
It would appear to have to do with the Python interface or Python runtime or even, perhaps, the underlying compiler runtime libraries. The message indicates an attempt somewhere in the bowels to a memory allocation problem; generally it indicates the attempt to free an already deallocted chunk of memory or a corrputed handle to such a memory block.
Greg
Greg on 18 Aug 2025
That you for your comment! So I've been able to scope down my issue even more based on what you said. I'm still not sure what exactly the issue is, HOWEVER I ended up testing my code with a different version of Python. The error takes place when I'm using Python 3.10.4 with MATLAB 2023b in the eigs function, however when I switched and used Python 3.9.21 I didn't receieve an out or memory error.
Is there a nuasce when using MATLAB Runtime 2023b and Python 3.10.4?

Sign in to comment.

Answers (1)

Christine Tobler
Christine Tobler on 18 Aug 2025
This seems to point to a memory corruption, the source of which is always hard to pinpoint (since the corruption could have happened quite a bit before the eventual crash).
You could send this in as a bug report - I'd say the first step would be to try to find minimal reproduction steps.
  2 Comments
Greg
Greg on 18 Aug 2025
That you for your comment! So I've been able to scope down my issue even more based on what you said. I'm still not sure what exactly the issue is, HOWEVER I ended up testing my code with a different version of Python. The error takes place when I'm using Python 3.10.4 with MATLAB 2023b in the eigs function, however when I switched and used Python 3.9.21 I didn't receieve an out or memory error.
Is there a nuasce when using MATLAB Runtime 2023b and Python 3.10.4?
Christine Tobler
Christine Tobler on 19 Aug 2025
I'm afraid I'm not an expert on MATLAB Runtime and its interaction with python. In this doc page:
It says that R2023b MATLAB runtime is compatible with both Python 3.9 and 3.10, generally speaking.
If using Python 3.10.4 fixes the issue, it's of course possible that this is due to some bug fix in python. Or it could be related to how MATLAB interacts with Python in 3.9 vs. 3.10, although without any knowledge I would expect there not to be too much special-case treatment in that interaction.

Sign in to comment.

Categories

Find more on Python Package Integration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!