Mex bad allocation error

Hi,
I have a mex file which i run from matlab. It works fine. However, if i try to run it multiple times in a loop ( about 25 times) i get "Unexpected Standard exception from MEX file. What() is:bad allocation" What is this error and what do i need to look for in order to fix it ?

3 件のコメント

Geoff Hayes
Geoff Hayes 2015 年 10 月 30 日
Itzik - are you allocating memory within your MEX function? Is the loop outside of the MEX function (so are you calling it 25 times from MATLAB, or iterating 25 times within the function)? You may need to post a subset of the code so that we can get an idea of what you are trying to do with this function.
Jan
Jan 2015 年 10 月 30 日
編集済み: Jan 2015 年 10 月 30 日
Please post the corresponding part of the code. It is impossible to fix code, which is not known.
Itzik Ben Shabat
Itzik Ben Shabat 2015 年 11 月 1 日
a. Yes, I am allocating memory within the MEX function.
b. The loop is outside the MEX function (iterating in MATLAB, not in the MEX).
when you ask for code snippet than i can understand you mean
I think I solved it - I forgot to delete some arrays i defined with pointers and using "new". so the block of memory was never released between runs. thanks anyway.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2015 年 10 月 30 日

コメント済み:

2015 年 11 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by