From: Dimi (christop++at++fhw.gr)
Date: 04/02/2002 05:54:32
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
This archive was generated by hypermail 2b29 : Tue Apr 02 2002 - 05:53:16 PST