sio2Free will make the memory leak????

View previous topic View next topic Go down

sio2Free will make the memory leak????

Post  terryc on Tue Feb 10, 2009 7:04 am

void sio2Free( void *_ptr )
{
unsigned int i = 0;

while( i != sio2memory->n_alloc )
{
if( _ptr == sio2memory->_SIO2meminfo[ i ]->ptr )
{
memcpy( &sio2memory->_SIO2meminfo[ i ],
&sio2memory->_SIO2meminfo[ i + 1 ],
( sio2memory->n_alloc - i ) * sizeof( SIO2meminfo * ) );

sio2memory->n_alloc--;
sio2memory->_SIO2meminfo = ( SIO2meminfo ** ) realloc( sio2memory->_SIO2meminfo,
sio2memory->n_alloc * sizeof( SIO2meminfo * ) );
break;
}

++i;
}
}

in the function , only free SIO2meminfo Node's memory ,but not free the point "ptr"'s memory

terryc

Posts : 11
Join date : 2009-02-08

View user profile

Back to top Go down

Re: sio2Free will make the memory leak????

Post  sio2interactive on Tue Feb 10, 2009 3:30 pm

Just use instruments with leaks, sio2_memory was written quickly back in the days when instruments was not as good as it is today Smile
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum