马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
关于内存释放的,不知道错误在哪里!请高手们指点。
double *parm=NULL,*tmp_parm=NULL,parm_oncurve,pnt_oncurve[3],dtol=0.0254;
int num_int,i;
UF_EVAL_p_t eval;
tag_t face;
uf_list_p_t edge_list;
UF_MODL_intersect_info_p_t *intersect=NULL;
UF_MODL_ask_face_edges(face,[$edge_list)]
UF_MODL_ask_list_count(edge_list,[$num_edge)]
parm=(double *)UF_allocate_memory(sizeof(double *),[$err)]
for(i=0;i<num_edge;i++)
{
UF_MODL_ask_list_item(edge_list,i,[$edge)]
UF_CALL(UF_MODL_intersect_objects(edge,curve,dtol,[$num_int,&intersect))]
if(num_int>0)
{
for(j=0;j<num_int;j++)
{
if(intersect[j]->intersect_type==UF_MODL_INTERSECT_POINT)
{
UF_EVAL_initialize(curve,[$eval)]
UF_CALL(UF_EVAL_evaluate_closest_point(eval,
intersect[j]->intersect.point.coords,[$parm_oncurve,pnt_oncurve))]
UF_EVAL_free(eval);
parm=(double *)UF_allocate_memory(sizeof(double *)*(num+1),
[$err)]
memcpy(parm,tmp_parm,sizeof(double)*(num));
parm[num]=parm_oncurve;
if(tmp_parm!=NULL)
UF_free(tmp_parm);
tmp_parm=parm;
num++;
}
else continue;
}
}
}
程序调试,当num=1时,此时tmp_parm[0]=0.553,没有问题,当num=2时,此时tmp_parm[0]=0.553,tmp_parm[1]=0.487也没有问题,当num=3时,tmp_parm[0]=0.553,tmp_parm[1]=0.487,tmp_parm[2]=0.315程序运行到UF_free(tmp_parm)时出错,ug显示错误
"Invalid trailer found in storage manage block"
实在不知道错误在哪里,请高手们指点!! |