|
-
July 13th, 2010, 09:19 AM
#1
delete[] mechanics
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|