I'm making a program that practices my skills with dynamic memory. The thing is, I know that they take up space on the fly, and I'm not sure that if I keep testing my program, if it will take up a noticeable chunk of the memory on my computer (actually I don't want to waste any of my hard drive with a bunch of tests). Do I need the "delete[]" function, or will the allocated memory erase itself after I'm finished running the program?
Memory allocated with new[] must be freed with delete[], but the operating system will free all memory that your program allocated when it exits, either way.
(actually I don't want to waste any of my hard drive with a bunch of tests)
It uses RAM memory not hard drive memory. Also, with a memory leak, you do not lose any physical memory, I mean, if you restart your computer the memory will be refreshed. You need to use delete or delete [].