RE: pfFlux bug?

New Message Reply Date view Thread view Subject view Author view

From: Dorosky, Christopher G (christopher.g.dorosky++at++lmco.com)
Date: 04/02/2002 08:31:35


You are honestly better off reusing them.
I have had severe problems getting Performer not to leak when deleting
pfUpdatable objects,
especially if there is a database process involved.
You could try pfAsyncDelete, but I don't think it will help.

Good Luck,

Chris

-----Original Message-----
From: Dimi [mailto:christop++at++fhw.gr]
Sent: Tuesday, April 02, 2002 7:55 AM
To: info-performer++at++sgi.com
Subject: pfFlux bug?

Hi,
I am trying ways for Dynamic loading of performer scene graphs.
During deletion of scene graphs with fluxes in them I noticed a slight
memory leak, which I could not credit to anything in my code.
To be exactly 8 bytes per flux.
So I wrote up a little app, which just loads and deletes a flux multiple
times
and prints the Shared Arena Usage. (In essence I modified the
deleteGraph.c example in
/usr/share/Performer/src/pguide/libpf/C).
Running this test app someone can clearly see the 8 bytes memory leakage
per pass,
like I noticed in my program.

Do I handle anything wrong? Is this a performer bug?

Hope you can help me
Dimi

I attach the small test app for reference below.
By uncommenting/commenting the
#define fluxi
line either a pfFlux or a pfGeode node get created and deleted per
pass.
Using a pfGeode node no Memory leakage occurs.

#include <stdlib.h>
#include <sys/types.h>
#include <malloc.h>
#include <Performer/pf.h>
#include <Performer/pfutil.h>
#include <Performer/pfdu.h>

#define fluxi

void print_arena_info (void);

int
main (int argc, char *argv[])
{
    pfPipe *p;
    pfPipeWindow *pw;
    pfChannel *chan;
    pfScene *scene;
    int i;
    int frame_number=0;
    pfGroup *group;

#ifdef fluxi
    pfFlux *delme;
#else
    pfGeode *delme;
#endif

    pfInit();

    pfMultiprocess( PFMP_DEFAULT );
    pfNotify (PFNFY_WARN, PFNFY_PRINT, "Running PFMP_DEFAULT\n");

    pfConfig();

    pfFilePath(".:/usr/share/Performer/data");

    /* Attach loaded file to a new pfScene. */
    scene = pfNewScene();
    group = pfNewGroup();
    pfAddChild(scene, group);
    pfAddChild(scene, pfNewLSource());

    /* Configure and open GL window */
    p = pfGetPipe(0);
    pw = pfNewPWin(p);
    pfPWinType(pw, PFPWIN_TYPE_X);
    pfPWinName(pw, "OpenGL Performer");
    pfPWinOriginSize(pw, 0, 0, 500, 500);
    /* Open and configure the GL window. */
    pfOpenPWin(pw);

    /* Create and configure a pfChannel. */
    chan = pfNewChan(p);
    pfChanScene(chan, scene);
    pfChanFOV(chan, 45.0f, 0.0f);

    while (1)
    {
        pfSync();

        pfFrame();

        print_arena_info();
        /*CREATE NODE*/
#ifdef fluxi
        delme=pfNewFlux (sizeof (float), PFFLUX_DEFAULT_NUM_BUFFERS,
pfGetSharedArena());
#else
        delme=pfNewGeode();
#endif
        /*DELETE NODE*/
        pfDelete(delme);

        frame_number ++;
        if (frame_number > 10)
        {
            pfExit();
            exit(0);
        }
    }
}

void print_arena_info (void)
{
    static int max_used = 0;
    int used;

    fprintf( stderr,
"\n=================================================\n");
    used = pfGetMemoryArenaBytesUsed();

    if (used < 0)
 fprintf(stderr, "### Warning: pfGetMemoryArenaBytesUsed works in the
DEBUG"
 " library ONLY.\n");

    if (used > max_used)
 max_used = used;

    fprintf(stderr, "Arena Bytes Used: %d, Max: %d\n", used, max_used);
    fprintf( stderr,
"=================================================");
    fflush (stderr);
}

--
                  Dimi Christopoulos {christop++at++fhw.gr}
                       VR Software Engineer
                 Foundation of the Hellenic World
                         Athens -  Greece

----------------------------------------------------------------------- List Archives, Info, FAQ: http://www.sgi.com/software/performer/ Open Development Project: http://oss.sgi.com/projects/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 2b29 : Tue Apr 02 2002 - 08:32:12 PST

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