Search code examples
phppythoncomettornadolong-polling

Memory Leaks Comet Server in PHP


Why would a Comet Server like Tornado be especially prone to memory leaks if written in PHP?

Are there genuine weaknesses particular to PHP for implementing a long polling framework/service like Tornado?

Thanks


Solution

  • The gist of it is that PHP was originally written with the intent of having a brand new process for every request that you could just throw away once said request ended, at a time where things like Comet and long polling weren't really on the table.

    As such there are quite a few areas - notably the garbage collector - where at its origin PHP just wasn't made for running during a long period of time, and it didn't care much because every http request got a brand new php instance.

    It got clearly better in the recent years, but I still wouldn't use it for creating that sort of long-lifetime applications.