Hi,
I'll try to explain my problem. I have made three very simple progams and I have compared the memory size each one takes with cmd "top". My problem is to understand how the function delete works.
the first one :
int main(int argc, char *argv[])
{
int i;
cin>>i;
return 0;
}
$top
Virtual: 1036 Res: 1032
The second :
int main(int argc, char *argv[])
{
int* tab = new int[100000];
delete[] tab;
int i;
cin>>i;
return 0;
}
$top
Virtual: 1036 Res: 1032
All memory is deallocated
The last:
int main(int argc, char *argv[])
{
//I have changed only the size of my array of int
int* tab = new int[2500];
delete[] tab;
int i;
cin>>i;
return 0;
}
$top
Virtual: 1040 Res: 1036
I have lost 4ko. Can someone explain me why?
In some cases all memory is deallocated, and in other not ....
