An example of trying to exhaust system memory

xiaoxiao2021-03-06  115

Void main (void)

{

FLOAT * P = NULL;

While (True)

{

P = new float [1000000];

COUT << "Eat Memory!" <

IF (p == NULL)

Exit (1);

}

}

For more than 32-bit applications, it is almost impossible to cause "memory consumption" whether using Malloc and New. I have written this test program with Visual C , see the above. This program will run without rest and will not terminate. Because the 32-bit operating system supports "virtual memory", the memory is used, and the hard disk space is automatically used. I only heard the hard disk, and the OS has been tired to the keyboard and the mouse has no response.

转载请注明原文地址:https://www.9cbs.com/read-125432.html

New Post(0)