Why does an infinitely recursive function in PHP cause a segfault?

后端 未结 3 1204
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 09:44

A hypothetical question for you all to chew on...

I recently answered another question on SO where a PHP script was segfaulting, and it reminded me of something I ha

3条回答
  •  萌比男神i
    2020-12-03 10:33

    Know nothing about PHP implementation, but it's not uncommon in a language runtime to leave pages unallocated at the "top" of the stack so that a segfault will occur if the stack overflows. Usually this is handled inside the runtime and either the stack is extended or a more elegant error is reported, but there could be implementations (and situations in others) where the segfault is simply allowed to rise (or escapes).

提交回复
热议问题