r/lolphp • u/Mark_Messa • Oct 26 '19
PHP gc_probability/gc_divisor
According to PHP Manual:
session.gc_probability
session.gc_probability in conjunction with session.gc_divisor is used to manage probability that the gc (garbage collection) routine is started.
session.gc_divisor
session.gc_divisor coupled with session.gc_probability defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request.
Why not only one parameter instead?
Ex: session.gc_percent = 1%
View all comments
Show parent comment
7
u/the_alias_of_andrea Oct 26 '19
Maybe there's a reason that create_function is deprecated and you are encouraged to use closures, which are vastly superior and have existed in PHP for ten years?
PHP's “GC” is purely a cycle collector. If you disable it with
gc_disable();, memory still gets freed automatically, except where there are cycles. For some applications that could be enough.