-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackOverflow.py
More file actions
31 lines (28 loc) · 908 Bytes
/
StackOverflow.py
File metadata and controls
31 lines (28 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import os #os package can be used to run terminal commands (like ulimit -s)
import threading
#Recursive method has no base case. Therefore it will go on to infinity
def recurse(n):
print(n)
sys.setrecursionlimit(sys.getrecursionlimit() + 1)
recurse(n+1)
#Making a thread with an infinite amount of memory allocated to it
#This option is great because you can have multiple threads using up memory
#simultaneously. This will break your computer faster
#Make size of thread
sys.setrecursionlimit(100000)
threading.stack_size(0x9900000)
#Create/Define threads using threading package
t = threading.Thread(target=recurse, args=(0,))
t2 = threading.Thread(target=recurse, args=(0,))
t3 = threading.Thread(target=recurse, args=(0,))
t4 = threading.Thread(target=recurse, args=(0,))
#Start threads
t.start()
t2.start()
t3.start()
t4.start()
t.join()
t2.join()
t3.join()
t4.join()