pfMemory clarification

New Message Reply Date view Thread view Subject view Author view

Dewey Anderson (dewey++at++evt.com)
Thu, 17 Apr 1997 15:20:54 -0600


I'm trying to track down some memory leaks and just want to verify that my
understanding of pfMemory is correct. This is C++ and Performer 2.0 in IRIX
5.3 on a High Impact.

Our application creates a rectangular block with a texture on one face, moves
it around and then pfDeletes it. The scene tree looks like this

Scene->pfSCS->pfDCS->pfSCS->pfGeode

As I understand it, pfSCS, pfGeoSet, pfGeoState, pfTexture, pfTexEnv, pfGeode
are all derived from pfObject and, hence, pfMemory and will be deleted when I
do a pfDelete on the lower pfSCS. (I explicitly pfDelete the pfDCS and upper
pfSCS for other reasons.) These objects are all created for this one object so
there should be no other references to them.

The coordinates, normals and color of the pfGeoSets are pfVecs and these are
NOT derived from pfMemory. I think that if I want them to be deleted, I need
to allocate them with pfMalloc instead of new, e.g.

pfVec3 *sidecoords = (pfVec3 *)pfMalloc( 20*sizeof(pfVec3), pfGetSharedArena()
);

instead of

pfVec3 *sidecoords = new pfVec3[20];

The image data in the pfTexture also needs to be allocated with pfMalloc if I
want it automatically deleted. As it happens, the function that builds this
pfGeode gets an image passed in that was not allocated with Performer. I've
tried two approaches here. One is to pfMalloc space for the image and make a
copy of it. This copy is used in setImage. I expect the pfDelete on the pfSCS
to take care of deleting this. (I independently take care of deleting the
original image.)

The second approach I take is to use the original image in setImage. In this
case I don't expect pfDelete to do anything to it since it's not pfMemory. But
I do take care of deleting it explicitly myself.

Are my expectations here correct? Do I have the right impression about what's
supposed to be getting deleted and what I have to do to make it work?

What concerns me here is that my memory leak behavior is very different
(reduced) when I simply comment out the code that creates the pfTexture and
attatches it to the pfGeoState.

Thanks,

Dewey Anderson
dewey++at++evt.com
Evolving Video Technologies

P.S. I've been told that Purify gets confused by the presence of hardware
texture memory and so can't be used here. Any truth to that?

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:05 PDT

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