这段代码有潜在危险吗?
我只是一个傻瓜,发现这样的小孩子脚本工具很有趣:)
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();
}
我的老师对我提出了严格要求,因为它是检查故障硬盘的好工具。我只是想知道这个循环是否足以导致电脑崩溃或对硬件造成永久性损坏......
I'm just 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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑这甚至会使机器崩溃。
每个进程都会占用一些内存,并且您很快就会耗尽内存,此时操作系统将拒绝启动任何更多任务。您可能会看到一个关于虚拟内存不足的对话框。
损坏硬件?你一定是在开玩笑。
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.