From: Yair Kurzion (yair++at++polygon.engr.sgi.com)
Date: 04/02/2002 12:00:20
Hi Dimi !
The function pfGetMemoryArenaBytesUsed mis-calculates the number of bytes
used by a pfFlux by 8 bytes. Performer version 2.5 contains a fix for this bug.
To verify that this is a pfGetMemoryArenaBytesUsed bug, try running your
program for a long time and watch what gmemusage reports on it.
-yair
>
> 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
> -----------------------------------------------------------------------
>
--
\_________ \_____ \__ \__ \_____
\_________ \_____ \__ \__ \_____ Yair Kurzion
\__ \__ \____\__ \__ yair++at++sgi.com
\__ \__ \__ (650) 933-6502
\__ \__ \__
\__ \__ \__
This archive was generated by hypermail 2b29 : Tue Apr 02 2002 - 12:00:28 PST