Hello, I have the following function:
CODE
std::string getTextOfCommand(char command[]){
            //adds "> tempfile.txt" to the command string, executes it with system()
            //reads the file to a string, deletes the file, and deletes the file.
    std::string retVar;
    char *holder;
    long unsigned int length;
    holder = new char[strlen(command)+16];
    strcpy(holder,command);
    strcat(holder," > tempfile.txt");
    system(holder);
    delete [] holder;
    std::ifstream file("tempfile.txt",std::ios::in);
    file.seekg(0,std::ios_base::end);
    length = file.tellg();
    holder = new char[length];
    file.seekg(0,std::ios_base::beg);
    file.read(holder,length);
    file.close();
    retVar=holder;
    delete [] holder;
    system("del /f tempfile.txt");
    return retVar;
}


I have it returning a string so that I can delete the character array "holder" before the program exits. However, I am curious: this program is designed to run for maybe 30 seconds max, and this function called maybe 3 or 4 times. If I allocate something with the new operator, and the program exits, does the Operating System keep the ram marked as used? Or is any ram used by a program released by the program upon exit?

Billy3

EDIT: The wikipedia article here seems to say I dont have to worry about deleting the array if I plan to have it destroyed at exit anyway:
http://en.wikipedia.org/wiki/Memory_leak
QUOTE
The memory leak would only last as long as the program was running. For example: if the lift's power were turned off the program would stop running. When power was turned on again, the program would restart and all the memory would be available again, and the slow process of leaking would start again.


Can anyone verify this?