Mex bad allocation error

17 visualizaciones (últimos 30 días)
Itzik Ben Shabat
Itzik Ben Shabat el 30 de Oct. de 2015
Comentada: Itzik Ben Shabat el 1 de Nov. de 2015
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 comentarios
Jan
Jan el 30 de Oct. de 2015
Editada: Jan el 30 de Oct. de 2015
Please post the corresponding part of the code. It is impossible to fix code, which is not known.
Itzik Ben Shabat
Itzik Ben Shabat el 1 de Nov. de 2015
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by