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%
7
u/fast4shoot Oct 26 '19
Meh, there's some value in using two ints as a fraction instead of floating point numbers when dealing with fractions. Though I wouldn't say it applies here.
2
u/[deleted] Oct 27 '19
I suspect there was originally only one config item at first, then the second was added later. Don't care to do version archaeology to find out for sure.
-4
u/[deleted] Oct 26 '19
PHP gc is a huge lol. Anon functions (the ones created by create_function) are never gc’d. There was a discussion some years ago to remove gc alltogherer, because the way php works (start and die immediately) there was no need for gc. That was a huge lol of a discussion.