Re: pfLinux memory weirdness

New Message Reply Date view Thread view Subject view Author view

From: Paul John Rajlich (prajlich++at++ncsa.uiuc.edu)
Date: 07/19/2000 12:09:03


Yair,

thanks for the info!

So, I guess I wrote the wrong sample program. :)
 
How about this one:

int main() {
  
  pfInit();
  pfMultiprocess(PFMP_DEFAULT);
  pfConfig();
  
  pfPipe *p = pfGetPipe(0);
  pfPipeWindow *pw = new pfPipeWindow(p);
  pw->setWinType(PFPWIN_TYPE_X);
  pw->setName("pfDelete");
  pw->setOriginSize(100, 100, 200, 200);
  pw->open();
  
  pfChannel *chan = new pfChannel(p);
  
  pfScene *scene = new pfScene;
  pfGeode *geode = new pfGeode;
  scene->addChild(geode);
  
  chan->setScene(scene);
  
  for (int i=0; i<1000; i++) {
    cout << i << " ";
    cout.flush();
    pfGeoSet *g = pfdNewSphere(10000, pfGetSharedArena());
    geode->addGSet(g);
    pfSync();
    pfFrame();
    geode->removeGSet(geode->getGSet(0));
    pfDelete(g);
  }
  
  pfExit();
  return 0;
}

It works on IRIX but not on Linux.

-Paul

----------------------------------------------------------------------
              Paul J. Rajlich - prajlich++at++ncsa.uiuc.edu
               Visualization and Virtual Environments
           National Center for Supercomputing Applications
               http://brighton.ncsa.uiuc.edu/~prajlich/
----------------------------------------------------------------------

On Wed, 19 Jul 2000, Yair Kurzion wrote:

> Hi Paul !
>
> pfDelete(g) is the correct way to do this. However, Performer processes
> executes delete requests on pfUpdatables (pfGeode is a pfUpdatable) a few
> frames after the call to pfDelete (in simple cases - 3 frames after).
>
> Since you don't call pfFrame in your loop, the memory is not deleted.
> Common applications call pfDelete on some scene graph nodes when needed, and
> then call pfFrame to draw the next frame.
>
> -yair
>
>
> > Somebody suggested that I try pfDelete(g). This doesn't work on
> > either Linux or IRIX!
> >
> > "delete g" works on IRIX, but not on Linux.
> >
> > -PAul
> >
> > ----------------------------------------------------------------------
> > Paul J. Rajlich - prajlich++at++ncsa.uiuc.edu
> > Visualization and Virtual Environments
> > National Center for Supercomputing Applications
> > http://brighton.ncsa.uiuc.edu/~prajlich/
> > ----------------------------------------------------------------------
> >
> > On Tue, 18 Jul 2000, Paul John Rajlich wrote:
> >
> > >
> > > Hi pfPeople,
> > >
> > > I'm having problems deleting pfGeoSets in pfLinux. To illustrate
> > > the problem, I've written a small program. The following code behaves
> > > well on my Octane:
> > >
> > > int main() {
> > >
> > > pfInit();
> > > pfMultiprocess(PFMP_DEFAULT);
> > > pfConfig();
> > >
> > > pfGeode *geode = new pfGeode();
> > >
> > > for (int i=0; i<1000; i++) {
> > > cout << i << " ";
> > > cout.flush();
> > > pfGeoSet *g = pfdNewSphere(10000, pfGetSharedArena());
> > > geode->addGSet(g);
> > > geode->removeGSet(geode->getGSet(0));
> > > delete g;
> > > }
> > >
> > > pfExit();
> > > return 0;
> > > }
> > >
> > > However, on Linux it fills up the heap. In the Linux version I use
> > > NULL instead of pfGetSharedArena().
> > >
> > > I have found that something like this works:
> > >
> > > pfVec3 *verts, *norms;
> > > pfVec4 *colors;
> > > ushort *dummy;
> > > g->getAttrLists(PFGS_COORD3, (void **)&verts, &dummy);
> > > g->getAttrLists(PFGS_NORMAL3, (void **)&norms, &dummy);
> > > g->getAttrLists(PFGS_COLOR4, (void **)&colors, &dummy);
> > > int *lengths = g->getPrimLengths();
> > > pfFree(pfGetMemory(verts));
> > > pfFree(pfGetMemory(norms));
> > > pfFree(pfGetMemory(colors));
> > > pfFree(pfGetMemory(lengths));
> > >
> > > but that's rather painful.
> > >
> > > Any ideas?
> > >
> > > -Paul
> > >
> > > ----------------------------------------------------------------------
> > > Paul J. Rajlich - prajlich++at++ncsa.uiuc.edu
> > > Visualization and Virtual Environments
> > > National Center for Supercomputing Applications
> > > http://brighton.ncsa.uiuc.edu/~prajlich/
> > > ----------------------------------------------------------------------
> > >
> > > -----------------------------------------------------------------------
> > > List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> > > Submissions: info-performer++at++sgi.com
> > > Admin. requests: info-performer-request++at++sgi.com
> > >
> >
> > -----------------------------------------------------------------------
> > List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
> >
>
>
> --
> \_________ \_____ \__ \__ \_____ Yair Kurzion
> \_________ \_____ \__ \__ \_____ yair++at++sgi.com
> \__ \__ \____\__ \__ http://reality.sgi.com/yair
> \__ \__ \__ Work: (650) 933-6502
> \__ \__ \__ Home: (408) 226-9771
> \__ \__ \__
>


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Jul 19 2000 - 12:09:13 PDT

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