English 中文(简体)
PHP的内存管理与Python的内存管理有何不同?
原标题:How is memory management in PHP different from that in Python?

它们的处理方式有什么不同?

具体地说,为什么在web服务器等生产级别的长寿命应用程序中使用Python很常见,而PHP的效率水平却不相似?

最佳回答

PHP被设计为一种超文本脚本语言。每一个过程都被设计为在很短的时间后结束。所以内存管理和GC基本上无关紧要。

然而,PHP的易用性和流行性使其在长寿命的程序中得到了应用,如守护进程、大量计算、套接字服务器等。

PHP 5.3引入了许多功能和修复程序,使其适用于此类应用程序,但在我看来,内存管理在这方面的重要性较低。

PHPs错误管理现在相当不错,但正如我所知道的每一种编程语言一样,都可能产生内存泄漏。

您仍然无法使用与编写Java或Python应用程序相同的样式进行编写。许多PHP程序可能会显示Java/Python没有的严重问题。

你可以将其描述为“更糟糕”,但我不会。PHP只是一套不同的工具,你必须处理不同的工具。

我工作的公司有很多用PHP编写的系统程序和守护程序,运行起来很有魅力。

当谈到“生产级长寿应用程序”时,我认为PHP最大的警告是它的多处理和线程能力(第二个基本上不存在)。

当然,也有可能分叉进程、访问共享内存、进行进程间通信以及拥有消息队列等。但Python在这方面遥遥领先,因为它是为这样的工作自下而上设计的。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签