Geobldr leak, with source

New Message Reply Date view Thread view Subject view Author view

From: christopher.g.dorosky++at++lmco.com
Date: 08/23/2000 07:19:30


Hello,

Here is an example of a simple geobldr program that leaks. I was wondering
if anybody could tell me what I was doing wrong.

Complile as is to get about 200K/sec leak, with NO_LEAK enabled for none,
and commenting out SINGLE_G to get a new bldr each time, with delete (still
leaks).

#include <stdlib.h>

#include <Performer/pf/pfNode.h>

#include
<Performer/pf/pfScene.h>

#include <Performer/pf/pfGeode.h>

#include
<Performer/pf/pfChannel.h>

#include <Performer/pfdu.h>

static void
dbase_func(void *);

pfScene **dscene;

pfScene *scene;

#define
SINGLE_G

//#define NO_LEAK

static void dbase_func(void *)

{

#ifdef NO_LEAK

return;

#endif

#ifdef SINGLE_G

    static pfdGeoBuilder *bldr;

#else

pfdGeoBuilder *bldr;

#endif

    static pfdTri pftri;

    static pfList
*list;

    sginap(5);

    pfDBase();

    static pfBuffer *buf=NULL;

    if
(!buf)

    {

        printf("Got new\n");

        buf = new pfBuffer;

buf->select();

#ifdef SINGLE_G

        bldr = pfdNewGeoBldr();

#endif

    }

if(buf==NULL)return;

#ifndef SINGLE_G

    bldr = pfdNewGeoBldr();

#endif

    for(int j=0;j<500; j++){

        pftri.coords[0][0]=1;

pftri.coords[0][1]=0;

        pftri.coords[0][2]=0;

        pftri.coords[1][0]=0;

pftri.coords[1][1]=1;

        pftri.coords[1][2]=0;

        pftri.coords[2][0]=-1;

pftri.coords[2][1]=0;

        pftri.coords[2][2]=0;

        

        pfdAddTri(bldr,
&pftri);

    }

    list = (pfList *) pfdBuildGSets( bldr );

    for(int
i=0;i<list->getNum();i++){

        if(pfDelete(list->get(i))!=TRUE)
printf("Delete problem\n");

    }

#ifndef SINGLE_G

pfdDelGeoBldr(bldr);

#endif

}

int

main (int argc, char *argv[])

{

float t = 0.0f;

    // Initialize Performer

    pfInit();

// Use
multiprocessing mode

    pfFrameRate(30.0f);

    pfPhase(PFPHASE_LOCK);

pfMultiprocess( PFMP_APPCULLDRAW|PFMP_FORK_DBASE );

    // initiate
multi-processing mode set in pfMultiprocess call

    // FORKs for Performer
processes, CULL and DRAW, etc. happen here.

    //

    pfConfig();

pfDBaseFunc(dbase_func);

    scene = new pfScene;

    pfPipe *p =
pfGetPipe(0);

    pfPipeWindow *pw = new pfPipeWindow(p);

pw->setWinType(PFPWIN_TYPE_X);

    pw->setName("IRIS Performer");

pw->setOriginSize(0,0,500,500);

    pw->open();

    // Create and configure
a pfChannel.

    pfChannel *chan = new pfChannel(p);

chan->setScene(scene);

    chan->setFOV(45.0f, 0.0f);

chan->setNearFar(1.0f, 10.0f);

    while (t < 30.0f)

    {

        // Go to
sleep until next frame time.

        pfSync();

        // Initiate cull/draw for
this frame.

        pfFrame();

        

        t = pfGetTime();

    }

    //
Terminate parallel processes and exit

    pfExit();

    return 0;

}

Here is the makefile to go with it.

CFLAGS = -xansi -mips3 -nostdinc -n32 -I/usr/include/CC -I/usr/include -O3
-OPT:Olimit=3000

LFLAGS = -all -ignore_unresolved

LIBS = -L/usr/lib32
-L/lib32 \

-lpf_ogl -lpfdu_ogl -lpfutil_ogl -lmpc -limage -lGLU -lGL
-lXext \

-lfpe -lXm -lXt -lXmu -lX11 -lm -lmalloc -lC

all:
geobldr

geobldr: geobldr.o

        CC geobldr.o $(CFLAGS) $(LFLAGS)
$(LIBS) -o geobldr

geobldr.o: geobldr.C

        CC $(CFLAGS) -c geobldr.C

On a related note...
I got a message from the SGI server saying I sent this to Andrew Vincent,
but that he left the company. I didn't do this.

Christopher Dorosky
Lead Electronic Systems Engineer - Real Time Simulation
Lockheed Martin Missiles and Fire Control - Dallas
christopher.g.dorosky++at++lmco.com
972-603-2349


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 07:19:45 PDT

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