FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

sio2Free will make the memory leak????

2 posters

Go down

sio2Free will make the memory leak???? Empty sio2Free will make the memory leak????

Post  terryc 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

Back to top Go down

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

Post  sio2interactive 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
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Back to top

- Similar topics

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