1
私は1回以上試みましたが、毎回同じエラーが発生します。このコードにはメモリリークの間違いがありますか?
Fatal error: Out of memory (allocated 507510784) (tried to allocate 16384 bytes) in ..(location)..\accounts.php on line 51
機能
public function getUser($userBase, $allowID = true, $allowUName = true, $allowEmail = true, $allowHash = true) {
// If nothing allowed!
if ($allowID == false && $allowUName == false && $allowEmail == false && $allowHash == false) {
return NULL;
}
if ($allowID == true) {
// User ID
$result = $this->conn->query("SELECT * FROM `accounts` WHERE `id` = {$userBase}");
if ($result && $result->num_rows > 0) {
return new user($this->conn, $userBase);
}
}
if ($allowUName == true) {
// User Name
$result = $this->conn->query("SELECT * FROM `accounts` WHERE `username` = '{$userBase}'");
if ($result && $result->num_rows > 0) {
return new user($this->conn, $userBase);
}
}
if ($allowEmail == true) {
// Email
$result = $this->conn->query("SELECT * FROM `accounts` WHERE `email` = '{$userBase}'");
if ($result && $result->num_rows > 0) {
return new user($this->conn, $userBase);
}
}
if ($allowHash == true) {
$result = $this->conn->query("SELECT * FROM `accounts` WHERE `hash` = '{$userBase}'");
if ($result && $result->num_rows > 0) {
return new user($this->conn, $userBase);
}
}
return NULL;
}
そしてこれは、私はそれを呼び出す行う方法です。
return this->getUser($uname, false, true, true, false);
この巨大なメモリを使用する理由はわかりません。
この前に何かしていることは、大量のメモリを使用していることです。これは単にラクダの背中を壊すストローです。 –
何もない、実際には何もありません。 –
それでは、507,510,784バイトのメモリを使用しているものはありません。 –