This C code (compiled as C++) is not freeing memory. The program starts out with 992kB on the 'new' line, then after allocating memory, it goes to 10MB. After freeing the memory, it only goes down to 3MB. Even doing a delete[] doesn't erase the memory. What am I doing wrong?
INT iSize=8192;
struct sUsernameA
{
TCHAR *sUsername;
};
sUsernameA *sArr = new sUsernameA[iSize]();
for (INT i=0;i<iSize;i++)
{
sArr[i].sUsername = (TCHAR*)calloc(512,sizeof(TCHAR));
}
for (INT i=0;i<iSize;i++)
{
free(sArr[i].sUsername);sArr[i].sUsername = NULL;
}
delete [] sArr;