File size: 409 Bytes
35c29ec
d94ccbe
 
 
35c29ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gc
import multiprocessing

bind = "0.0.0.0:23456"
# workers = multiprocessing.cpu_count()
workers = 1
preload_app = True

# disable GC in master as early as possible
gc.disable()

def when_ready(server):
    # freeze objects after preloading app
    gc.freeze()
    print("Objects frozen in perm gen: ", gc.get_freeze_count())

def post_fork(server, worker):
    # reenable GC on worker
    gc.enable()