Re: Memory Management

New Message Reply Date view Thread view Subject view Author view

From: Michael Lewis (mlewis++at++evl.uic.edu)
Date: 06/26/2001 13:56:49


Hello

I wrote a simple program to test out memory management, and it turns out
when
traversing through the nodes and doing a delete/ unrefDelete, or
delete/ checkDelete on the
geosets in the pfNode tree (created using pfdLoadFile) , the shared
memory still does not
update. I did a amallinfo before and after
the recursive deletion and still the available shared memory didnt
change.

Also I tried traversing a pfNode tree and doing a getSize on the geosets
in the
pfNode and I received a total size of 0.

This test was done loading one pfNode at a time getting the size before
and after,
And deleting one pfNode at a time then getting
the size before and after

So I am still unsuccessfull in finding what the true free memory
available is after a recursive deletion of a node.
And I still cant find what the true memory size of a loaded object is
after recursively calling getSize on its geoSets. Any
suggestion, or is this a flaw of Performer.

Here are the two main functions I used for traversing the tree and
deleting and
traversing the tree and getting the size.

Thanks

Mike

void traverseDelete(pfNode *node)
{
 int i;
 if (node->isOfType(pfGeode::getClassType()))
 {
        pfGeode *geode = (pfGeode *)node;
        for (i=0; i < geode->getNumGSets(); i++)
         {
                     pfGeoSet *gset = geode->getGSet(i);
                     delete(gset);
                     int val = FALSE;
                     // while ( !(val == TRUE))
                     val = gset->unrefDelete();

                     if (val == TRUE) printf("Geoset %d from %d sets has
been deleted \n",i,geode->getNumGSets());
         }
 }
 else if (node->isOfType(pfGroup::getClassType()))
  {
        pfGroup *group = (pfGroup *)node;
        for (i=0; i < group->getNumChildren(); i++)
                {
                traverseDelete(group->getChild(i));
                }
   }
}

void getMemSize(pfNode *node)
{
      int i;
      if (node->isOfType(pfGeode::getClassType()))
      {
              pfGeode *geode = (pfGeode *)node;
              for (i=0; i < geode->getNumGSets(); i++)
                {
                pfGeoSet *gset = geode->getGSet(i);
                int geoSetSize = gset->getSize();
                printf("Geoset %d from %d size is %d
\n",i,geode->getNumGSets(),geoSetSize);
                totalSize = totalSize + geoSetSize;
                }
         }
      else if (node->isOfType(pfGroup::getClassType()))
      {
               pfGroup *group = (pfGroup *)node;
               for (i=0; i < group->getNumChildren(); i++)
                {
                getMemSize(group->getChild(i));
                }
        }

}

--
  Michael J. Lewis
  mlewis++at++evl.uic.edu


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Jun 26 2001 - 13:50:35 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.