Dynamic Memory

Sep 4, 2012 at 1:57am
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?
Sep 4, 2012 at 2:21am
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.

And memory refers to RAM, not the hard disk.
Sep 4, 2012 at 2:24am
(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 [].
Last edited on Sep 21, 2012 at 5:54pm
Sep 4, 2012 at 2:27am
Oops. Yeah as you can see that kind of stuff is fuzzy, but thanks for the advice.
Topic archived. No new replies allowed.