Hey all,

I've looked all over for how delete[] *exactly* works. I *thought* it just performed the delete operation until it found a null, but this seems wrong.

Could someone explain if this leaks memory or not?

char a = new char[50];
a[0] = '\0';
delete[] a;

Also, what is there a defined behavior for
char a = new char[50];
delete[] &a[7];

When delete[] is called, does it look up how much memory was allocated to this starting address then clean it all up? All the documentation just says it frees memory for the corresponding new[].

Thanks!