How is memory management in PHP different from managing in Python?

What is the difference in how they are processed?

In particular, why is it usually necessary to find Python that is used in long-term production-level applications such as web servers, while PHP does not have the same performance levels?

+7
source share
1 answer

PHP was developed as a hypertext scripting language. Each process was designed to be completed in a very short time. Therefore, memory management and GC basically did not matter.

However, the ease and popularity of PHP is caused by its use in durable programs such as daemons, extensive computing, socket servers, etc.

PHP 5.3 introduced many features and fixes that made it suitable for such applications, however, in my opinion, memory management was less important in this regard.

PHP error management is not bad at the moment, but, like all the programming languages ​​that I know about you, you can create memory leaks.

You still cannot code in the same style as Java or Python code. Many PHP programs are likely to show serious problems when Java / Python does not.

You can describe it as “worse,” but I would not do it. PHP is a different set of tools that you must handle differently.

The company I work for has a lot of system programs and daemons written in PHP that work like a charm.

I think the biggest caveat for PHP when it comes to how you describe “long-lived applications at the production level” is multi-processor and multi-threaded ability (the second basically does not exist).

Of course, there is an opportunity for fork processes, access to shared memory, interactions between processes and message queues, and more. But Python is far ahead in this matter because it was developed from the bottom up for such tasks.

+7
source

All Articles