我需要担心PHP的内存泄漏吗?特别是,我有以下从浏览器中调用的代码。当调用完成时,是否正确清理了所有内容,或者,是否需要清除由创建的第一个数组创建的内存?PHP内存管理和阵列
class SomeClass
{
var $someArray = array();
function someMethod()
{
$this->someArray[1] = "Some Value 1";
$this->someArray[2] = "Some Value 2";
$this->someArray[3] = "Some Value 3";
$this->someArray = array();
$this->someArray[1] = "Some other Value";
$this->someArray[2] = "Some other Value";
$this->someArray[3] = "Some other Value";
}
}
someMethod();
感谢, 斯科特
每个脚本调用都会启动一个新的PHP进程。这些呼叫之间的所有内存都会丢失。 – mario