Is this code potentially dangerous? [closed]
I'm j开发者_运维百科ust a fool who finds such kiddy script tools fascinating :)
for(i = 0; i < 100000000000000000000000; i++)
{
System.Diagnostics.Process StartTheKill;
StartTheKill = new System.Diagnostics.Process();
StartTheKill.EnableRaisingEvents = false;
string TheCommand;
TheCommand = "/C tree C:/";
System.Diagnostics.Process.Start("CMD.exe", TheCommand);
StartTheKill.Close();
}
My teacher tough me this because it's a great tool for checking fault hard drives. I just wonder if this loop would be enough to crash the PC or cause permanent damage to the hardware...
I doubt this would even crash the machine.
Each process will take some memory, and you'll soon run out of memory at which point the OS will refuse to start any more tasks. You'll probably see a nice dialog about running low on virtual memory.
Damage the hardware? you must be joking.
精彩评论