Ken Sakai (sakai++at++sgi600.msd.lmsc.lockheed.com)
Tue, 28 Jan 1997 08:24:17 -0800
I have been trying to write a function that would free memory for a
Performer subgraph given the root node of the subgraph to be deleted.
The function shown below is designed to do this by traversing the subtree
deleting geosets and nodes from the bottom up. The function seems to
work fine on our R4400 ONYX but I get Performer memory corruption as
indicated by pfDirtCheck warnings when I run the code on on a R10000
machine. In particular, I core dump when I later use pfNodeTravMask()
to set node traversal masks on the parts of the scene graph that
still remain (parts that have not been deleted using this function). Can
anyone spot a problem with what I am doing? (I assume that many others
have written similar functions to delete Performer subgraphs) Could this
be some sort of bug? (I am compiling O32 mode using Performer 2.0.) Any
help would be GREATLY appreciated as I have been fighting this problem
for a while.
//---------------------------------------------------------------------------
// void deleteRecursor(pfNode *node)
//---------------------------------------------------------------------------
void deleteRecursor(pfNode *node)
{
long i,j;
long num_children;
long numgeosets;
pfGeoSet *geoset;
long rval;
pfGroup *parent;
long numParents;
long node_id = pfGetId(node);
pfNode *child_node;
if(!pfIsOfType(node,pfGetGeodeClassType()) &&
!pfIsOfType(node,pfGetLPointClassType()) &&
!pfIsOfType(node,pfGetBboardClassType()))
{
num_children = pfGetNumChildren((const pfGroup *)node);
for(i = num_children - 1; i >= 0; i--)
{
child_node = pfGetChild((const pfGroup *)node,i);
deleteRecursor(child_node);
}
}
else if(pfIsOfType(node,pfGetGeodeClassType()))
{
pfGeode *geode = (pfGeode *)node;
if(numgeosets = pfGetNumGSets(geode))
{
for(j = numgeosets - 1; j >= 0; j--)
{
geoset = pfGetGSet(geode,j);
pfRemoveGSet(geode,geoset);
rval = pfDelete(geoset);
if(rval == FALSE)
{
cerr << "Geoset cannot be deleted\n";
}
}
}
}
numParents = pfGetNumParents(node);
for(j = numParents - 1; j >=0; j--)
{
parent = pfGetParent(node,j);
pfRemoveChild(parent,node);
}
rval = pfDelete(node);
if(rval == FALSE)
{
cerr << "Node cannot be deleted\n";
}
}
Thanks,
Kenneth N. Sakai Lockheed Martin Missiles & Space
Research Specialist/3-D Computer Graphics P.O. Box 3504
Email: sakai++at++lmsc.lockheed.com Sunnyvale, CA 94088-3504
Phone: (408) 756-0682
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:28 PDT