lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi lua-l
 i create a thread using __beginthread and in this thread i open the lua:
if( 0 != pUS->script_path[0] ){
  pUS->L = luaL_newstate();
in this thread i using lua to process the string, and all goes well,
after i allocate a memory block using malloc in thread :
if( NULL != pUS->L ){
    rrhd.ori_len = strlen(rrhd.pdata);
   pUS->prhd[pUS->rhd_rear].ori_len = rrhd.ori_len;
   pUS->prhd[pUS->rhd_rear].pdata = (char *)malloc(sizeof(char)*rrhd.ori_len);
   memcpy(pUS->prhd[pUS->rhd_rear].pdata ,rrhd.pdata,sizeof(char)*rrhd.ori_len);
   pUS->rhd_rear = (pUS->rhd_rear+1)%1000;
the lua_close crash down the app( power off kind)...
I send a email previous about the luaM_freearray causing the problem and now , i found that is lua_close. It cloud not
close successfully. If i commented the allocate code , lua_close successfully.