Ok I'm using a utility Dmalloc to help me track down all my mem leaks and
theirs one I'm not sertain on and I was wondering if someone could tell me
if this needs to be freeed or what it's doing:
void *alloc_perm( int sMem )
{
    static char *pMemPerm;
    static int iMemPerm;
    void *pMem;

    while ( sMem % sizeof(long) != 0 )
 sMem++;
    if ( sMem > MAX_PERM_BLOCK )
    {
 bug( "Alloc_perm: %d too large.", sMem );
 exit( 1 );
    }

    if ( pMemPerm == NULL || iMemPerm + sMem > MAX_PERM_BLOCK )
    {
 iMemPerm = 0;
---> if ( ( pMemPerm = (char*)calloc( 1, MAX_PERM_BLOCK ) ) == NULL )
 {
     perror( "Alloc_perm" );
     exit( 1 );
 }
    }

    pMem        = pMemPerm + iMemPerm;
    iMemPerm   += sMem;
    nAllocPerm += 1;
    sAllocPerm += sMem;
    return pMem;
}

were I added the little ---> is the line that is leaking is their a reason
thats a static and why it's not being freeded?


Reply via email to