2016-03-30 25 views
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); 

この巨大なメモリを使用する理由はわかりません。

+0

この前に何かしていることは、大量のメモリを使用していることです。これは単にラクダの背中を壊すストローです。 –

+0

何もない、実際には何もありません。 –

+3

それでは、507,510,784バイトのメモリを使用しているものはありません。 –

答えて

0

まあはこれまでのところ、私はデータベースと負荷に接続する新しいユーザーをcontaing問題に

ラインを理解して、その後に障害が発生した結果に到達しようと無限ループが発生し、再び自己!

関連する問題