我需要擔心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