"Xueming " <email@example.com> wrote in message <firstname.lastname@example.org>... > > James,hank you very much for pointing out my misunderstanding of garbage collection mechanism, and my careless about pointer initialization. I found the memory management issues on Mathwork website, and gonna take a look very carefully. > Btw, I tried to put mexMakeArrayPersistent(mxCell_g); > following > mxSetCell(mxCell1,1,mxString); > mxCell_g=mxCell1; > but it did work. I was wondering since there is a cell in mxCell1, should I keep it from being destroyed as well?
What do you mean "... but it did not work"? Can you show your current code and what errors/problems you are currently encountering? As far as mxCell1 being a cell, that makes no difference ... mexMakeArrayPersistent works regardless of the type of variable argument.