Suna,
Try to un-check the "deallocate Memory as soon as possible" setting under RT Target Options and see if that helps. One more thing of interest would be to make sure you are not exceeding the memory(RAM) size in the middle of your application.
Let us know if that helps,
Pravin