how to debug out of memory issues
<p>Hi 
I have a script that returns all the records stored in a mysql table. This script works perfectly fine on my xampp server which has a standard 128MB memory limit. </p>

<p>Fatal error: Out of memory (allocated 524288) (tried to allocate 4294967294 bytes) in /websites/LinuxPackage02/nw/cc/_u/nwcc-uk.org/public_html/code/Article.php on line 37</p>

<p>But when upload it onto web fusions myserverworld platform, it crashes. How would I debug such an issue? Why is it trying to assign 4GB of memory? The weird thing is, My dev server only has 2GB so how could it assign 4. </p>

<pre><code>  public function getActivity($id,$language='ch')
    {

    $mysqli = new Database();
        $mysqli-&gt;connect();

    $mysqli-&gt;query("SET character_set_results=utf8");   
    $sql = ($language == 'ch') ? 'SELECT id,title,text,date,author FROM article_chinese WHERE id=?': 'SELECT id,title,text,date,author FROM article_english WHERE id=?';
      if ($stmt = $mysqli-&gt;prepare("$sql")) {
          $stmt-&gt;bind_param("i", $id);
              /* execute query */
          $stmt-&gt;execute();

          /* bind result variables */
          $stmt-&gt;bind_result($id,$title,$text,$date,$author);

          /* fetch value */
          $stmt-&gt;fetch();
          $results = array($id,$title,$text,$date,$author);
          $stmt-&gt;close();
          $mysqli-&gt;close();
          return $results;
    /* close statement */


      }
    }
</code></pre>
