strings are set to empty string upon initialization, every time you run the program.
some things are not; an empty array or a grabbed memory block could be the same as last run (not reliable! do not write anything assuming it will persist!).
Edit: my compiler appears to clear vectors for you too. I did not realize it had this inefficiency.
jonnin, regarding your example of std::vector<int>(100), I actually am not certain to whether or not it is initialized. Maybe an expert can speak to it.
std::vector always default-constructs elements allocated by the std::vector constructor or by resize(), when a value parameter is not provided. In the case of integers and floats, this means zero-filling. An implementation that doesn't do this is incorrect.
Thanks; I have not spent a lot of time trying to break the STL containers and was unsure. I thought it would just use a new statement and keep it as quick as possible. Sorry for the edit, I didn't want to be confusing so I took the wrong info back out.
codingday, show us an actual example of what you're talking about.
All memory allocated by the program will be released back to the OS at the end of the program, although in general it is best practice to delete anything you new, especially for any long-running program, because you don't want memory leaks.
But that's beside the point, because if you're just doing something simple like vector<int>, and not actually using new/delete yourself, all memory will be automatically cleaned up when the vector<int> goes out of scope (for example, at the end of main). So you don't need to worry about it.
setting everything to zero at the end of the program is just wasting time.
if a program is getting stale memory values out of ram from the execution of previous programs (including itself), the problem needs to be fixed on the FRONT END so that does not happen, not on the back end by trying to zero out ram. If all the programs are doing things correctly, there is never any need to do this (exception, extremely low level, no-OS running, hardware may have this kind of need). If you need to do this for a weird system, it would be documented with bold, underlined, blocked out text warning you to make it so.
One time I was writing a password generation program. I'm not sure how I managed it, but I was getting strings from process names that had run previously. "Studio" was a frequent substring in my passwords. This was as late as the Windows 7 days.
Sounds like you used the output from tasklist as a source of entropy.
It's also worth noting that while the program's memory will be cleaned up by the OS, stuff allocated in DLL calls might still contain information from the previous DLL call, e.g. the characters in a global char array in the DLL's logic.