From: Shota on
Hi,

I have a small MEX file written in C. In side, there is a for loop, and in each iteration the for loop, I allocate a very small amount of memory by doing calloc(6, sizeof(int))

However, in the 9th iteration, calloc already fails, which is impossible, and I'm pretty sure MATLAB can allocate a lot more memory from heap.

I even freed the unused memory at the end of each iteration, but still the same thing happens. I greatly appreciate your help.
From: James Tursa on
"Shota " <shotaemail(a)gmail.com> wrote in message <hrl01t$r7a$1(a)fred.mathworks.com>...
> Hi,
>
> I have a small MEX file written in C. In side, there is a for loop, and in each iteration the for loop, I allocate a very small amount of memory by doing calloc(6, sizeof(int))
>
> However, in the 9th iteration, calloc already fails, which is impossible, and I'm pretty sure MATLAB can allocate a lot more memory from heap.
>
> I even freed the unused memory at the end of each iteration, but still the same thing happens. I greatly appreciate your help.

Can't give you any help unless you post your code. Also, what do you mean by "fails"?

James Tursa