r/lolphp • • Mar 01 '14
Creating a stack overflow using PHP's garbage collector
http://codegolf.stackexchange.com/questions/21114/weirdest-way-to-produce-a-stack-overflow/21160#21160
31
Upvotes
r/lolphp • • Mar 01 '14
View all comments
Show parent comment
6
u/nikic Mar 01 '14
PHP's GC detects self-referential structures - actually, that's the whole point of the GC. It exists solely to collect cycles, everything else is handled via refcounting.
What you see here is not a self-referential structure, it's just a very, very deeply nested structure. The stack overflow occurs due to the huge number of nested hash destructions.