//Memory Leak
#include <iostream>
using namespace std;
//Function Prototype
void createLeak(int &allocation);
int main()
{
//Variable Declaration
int allocationAmmount = 100;
int incrementSpeed = 1;
cout << "Welcome to the Memory Leak Program, enjoy the ride and watchout for the crash!\n" << endl;
do
{
cout << "Please enter the speed in which you would like to crash your computer (1-100): ";
cin >> incrementSpeed;
} while (incrementSpeed < 1 || incrementSpeed > 100);
while(true)
{
allocationAmmount += incrementSpeed;
createLeak(allocationAmmount);
}
return 0;
}
void createLeak(int &allocation)
{
int* leak = new int(allocation);
}
I know this program works for I used it and then looked at task manager. When incrementSpeed = 2 it allocates about 1GB of memory in 5 seconds. Im assuming this would crash a computer once it used up all the RAM and moved to the pagefile. Although I am not sure and I do not want to test, nor do I want you guys to test. Basicly Im wondering if windows has anyway of detecting this from what I can tell it doesn't. Thanks!


Sign In
Create Account


Back to top









