title: Array taking up waay too much memory
body: <p>I am creating an array to hold values returned from a query - It seems adding to a multi dimensional array causes the script to take upto 125Mb of memory and considering the total amount of data that the array is supposed to hold is not more than 5Mb it's very weird: </p>
  
  <p>Here is what I am doing: </p>
  
  <pre><code>try 
  {
      if (!$link = mysql_connect(DB_Host, DB_User, DB_Password))
              Throw New Exception(mysql_error());
      if (!mysql_select_db("Spexplus_Demo"))
              throw New Exception(mysql_error());
  } 
  catch (Exception $e) 
  {
      echo $e-&gt;getMessage().$e-&gt;getTraceAsString();
      exit(1);
  }
  
  $query = "select cda.categoryid as categoryId, 
                    cda.templatetype as templateType, 
                    hn.headerid as headerId, 
                    hn.name as headerName, 
                    an.attributeid as attributeId, 
                    an.name as attributeName
                    from categorydisplayattributes cda 
                    join categoryheader ch on cda.headerid = ch.headerid 
                    and cda.templatetype = ch.templatetype 
                    and cda.categoryid = ch.categoryid 
                    join headernames hn on cda.headerid = hn.headerid 
                    and hn.localeid = 1
                    join attributenames an on cda.attributeid = an.attributeid 
                    and an.localeid = 1";
  
  $result = mysql_query($query);
  
  while($row = mysql_fetch_assoc($result))
  
          {
              $categorydisplayattributes[$row['categoryId']][$row['templateType']][$row['headerId']][$row['headerName']][$row['attributeId']][$row['attributeName']] =array() ;
          }
  
  
  echo "Memory After CDA:".memory_get_usage(TRUE).Line_Terminator;
  exit();
  </code></pre>
  
  <p>The query result itself doesn't go beyond 5Mb or so when I check, however, assigning the values to the array in this fashion causes the spike - Has anyone else encountered something like this?</p>