From: Scott Herod (herod++at++rtset.com)
Date: 02/08/2000 15:13:14
Hello Joaquín,
My experience in IRIX is that it is not helpful to rely
on something like top or gmemusage to watch for memory
leaks. I've found it really useful to use code such as
the following on IRIX:
#ifdef DEBUG_MEM
#include <malloc.h>
#endif
#ifdef DEBUG_MEM
struct mallinfo mem_info;
mem_info = amallinfo( pfGetSharedArena() );
fprintf( stderr, "\n At start.\n" );
fprintf(stderr, "Arena space: %d in use: small: %d ord: %d\n",
mem_info.arena, mem_info.usmblks, mem_info.uordblks );
mem_info = mallinfo( );
fprintf(stderr, "Regular space: %d in use: small: %d ord: %d\n",
mem_info.arena, mem_info.usmblks, mem_info.uordblks );
#endif
With Performer, I've only seen a couple of things that you
have to be careful with. First, you cannot delete pfChannels.
Second, with textures, make sure that you also call
pfTexture::deleteGLHandle(). I use something like the following:
// Delete GLHandles for all textures
if ( model ) {
// Don't do this if we don't have a valid graphics context. The
// following does really bad things in that case.
if ( glXGetCurrentDrawable( ) && glXGetCurrentContext( ) ) {
pfList *tex_list = pfuMakeTexList( model );
int num_texs = tex_list->getNum();
for ( int i=0; i<num_texs ; i++ ) {
pfTexture *tex = (pfTexture *)tex_list->get(i);
if ( tex ) {
#if ( PF_MAJOR_VERSION == 2 && PF_MINOR_VERSION == 2 )
tex->deleteGLHandle(); // For Performer 2.2
#endif
}
}
pfDelete( tex_list );
}
}
( Note: pfuMakeTexList() leaks. I believe that this has been
fixed in the current release or is slated for the next release. )
Third and last, use pfMalloc to create pfVec's for colors, vertices,
etc.
color = (pfVec4 *)pfMalloc(sizeof(pfVec4),pfGetSharedArena());
I'm sorry that I can't address Linux specific issues.
Scott Herod
herod++at++rtset.com
Joaquín Casillas Meléndez wrote:
>
> Hello.
>
> I'm trying to delete some nodes in my pfapp at run time in order to free
> memory. I have tried pfDelete, pfUnrefDelete, pfFree, ..., without
> succesful. Memory don't seem to be freed at all. I have checked the ref
> value of the nodes and seems to be right in some cases, but in other the
> ref count of the node is greater than one and I force it to be zero
> (pfDelete always returns TRUE).
>
> Any help about deleteting/freeing memory would be greatly appreciated.
> Thanks.
>
This archive was generated by hypermail 2b29 : Tue Feb 08 2000 - 15:14:46 PST