<p>I'm building a webpage that queries a MySQL database and (currently) produces a text-only list of the findings. The queries to complete a single record are similar to:</p>

<ul>
<li>movie (title, description, etc)

<ul>
<li>actors in the movie (name, gender)</li>
<li>related movies</li>
</ul></li>
</ul>

<p>Out of curiosity I've used <code>memory_get_peak_usage()</code> and <code>memory_get_usage()</code>:</p>

<pre>
start   110,440 bytes
peak    656,056 bytes
end 637,976 bytes
time    0.008 seconds
</pre>

<p>The above is with no records found!</p>

<p>With 40 records I'm reaching approximately 2MB, though the time remains the same.</p>

<p>I know that premature optimization is evil and all, but I have to ask: </p>

<p>Do I need to do some reworking? Is this memory usage normal? What is considered excessive?</p>

Ultimately it's preferable to optimize when convenient of course, but 2MB of memory use sounds fine. PHP4 has a default config of 8mb, and PHP5 16mb. A lot of pre-packaged PHP builds will have different configs, of course, but generally speaking, if you can keep your app under 8mb, you can be sure it'll be highly portable in that regard.