Your task is to create a memory leak. This is a program that uses loads of memory, until the computer runs out and has to do some swapping to save itself from running out. The only way that the memory can be released is by killing the program in the task manager or using a command line kill such as taskkill /im yourprogram /f
(in Windows) or even restarting the computer. Merely closing the app should not prevent it from continuing to hog memory.
Rules:
Fork bombs of any sort are banned. That means that infamous Bash line
:(){ :|:&};:
is banned!The application must be single-threaded only. This implies the fork bomb rule.
The program must not run other programs. This means that you can't just do something like
run(memoryfiller.exe)
. The only exception to this is programs that are bundled with your OS or language, that are not primarily designed to consume memory (i.e. they have another purpose). This means that things likecat
andln -s
are permitted.You can take up as much memory as you like. The more the better.
Code must be explained fully.
Good luck. This is a popularity contest so the code with the most votes after 10 days from the asking date wins!
while(1)malloc(999);
? \$\endgroup\$