Re: pfDelete problem, again

New Message Reply Date view Thread view Subject view Author view

Gan Wang (rock.csd.sgi.com!sgi.com!uunet.uu.net!ds9!cavalier!gan)
Sat, 3 May 1997 11:26:14 -0700


You didn't call a single pfFrame() in your program, and that is where Performer
does many magical and critical things, including bookkeeping on the scene graph
and pfMemory. While pfDelete tries to honor reference counts, I don't know how
Performer would handle this without a pfFrame. Anyone knows?

Gan

On May 1, 11:52pm, Masanori Kakimoto wrote:
> Subject: pfDelete problem, again
> In the attached program, pfDelete does not really delete nodes
> with Performer2.1 on an Onyx IR.
>
> Please try making "bbox" and run with an input file while watching
> memory consumption with 'gr_osview -a'. If you try big <repeats>,
> the shared arena will eventually run out, which should not happen if
> these pfDelete's are working.
>
> Could anyone point out what is wrong?
>
>
> /*
> * bbox.C -- Prints bounding box data of a 3D model file.
> * Use modified /usr/share/Performer/src/pguide/libpf/C++/Makefile to
> * compile.
> * Written by Masanori Kakimoto (kaki++at++nsg.sgi.com)
> */
>
> #include <stdio.h>
> #include <stdlib.h>
>
> #include <Performer/pf.h>
> #include <Performer/pf/pfScene.h>
>
> #include <Performer/pfdu.h>
> #include <Performer/pfutil.h>
>
> void PrintBBox(char *fileName, int repeats);
> void MyPfDelete(pfMemory *ptr);
>
> int
> main(int argc, char *argv[])
> {
> if (argc != 3) {
> fprintf(stderr, "Usage: %s <filename> <repeats>\n", argv[0]);
> exit(1);
> }
> pfInit();
> pfuInitUtil();
> pfdInitConverter(argv[1]);
> pfConfig();
> pfFilePath(".:/usr/share/Performer/data");
>
> // Repeat loading and pfDelete'ing.
> PrintBBox(argv[1], atoi(argv[2]));
>
> while (1) {
> if (getchar() == 'a') {
> break;
> }
> }
> }
>
> void
> PrintBBox(char *fileName, int repeats)
> /* Computes bounding box of the model file and print min[x,y,z] and
> max[x,y,z] to standard output.
> */
> {
> int i;
> pfScene *tmpScene = new pfScene;
>
> for (i = 0; i < repeats; i++) {
> pfNode *aNode = pfdLoadFile(fileName);
> pfBox bbox;
>
> if (aNode != NULL) {
> tmpScene->addChild(aNode);
> #if 1
> pfuTravCalcBBox(aNode, &bbox);
> printf("%s (%d) %.1f %.1f %.1f %.1f %.1f %.1f\n",
> fileName, i,
> bbox.min[0], bbox.min[1], bbox.min[2],
> bbox.max[0], bbox.max[1], bbox.max[2]);
> #endif
> tmpScene->removeChild(aNode);
> MyPfDelete(aNode);
> }
> }
> MyPfDelete(tmpScene);
> }
>
> void
> MyPfDelete(pfMemory *ptr)
> {
> int deleted;
>
> deleted = pfDelete(ptr);
>
> if (deleted == TRUE) {
> fprintf(stderr, "pfDelete succeeded.\n");
> } else if (deleted == FALSE) {
> fprintf(stderr, "pfDelete failed.\n");
> } else if (deleted == -1) {
> fprintf(stderr, "pfDelete failed for non-pfMemory.\n");
> } else {
> fprintf(stderr, "pfDelete returned %d.\n", deleted);
> }
> }
>
>
> --
> Masanori Kakimoto mailto:kaki++at++nsg.sgi.com
> East Asia Technology Network, Tokyo Center
> c/o Nihon Silicon Graphics Cray
> Tel:81-3-5488-1852 Fax:81-3-5420-2397
> Voice mail: (external)81-3-5488-1863-1119 (internal)822-1119
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-- End of excerpt from Masanori Kakimoto

-- 

Gan Wang

Cambridge Research Associates Voice: 703-790-0505 ext.7210 1430 Spring Hill Road, Suite 200 Fax: 703-790-0370 McLean, VA 22102 E-mail: gan++at++cambridge.com ======================================================================= 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:11 PDT

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