I was running into memory limitations on my web host and I don't understand why. I had to start manually start setting an instance of the template class to null to prevent this memory issue. My question is why to have set this to null? Isn't PHP suppose to clean up class instances, database connections, etc. when the script as ended or force exited?

Here is a small example of my code (real pages have much more code and larger template html)... maybe someone can point out a problem:

require_once "islayout.php";

// The HTML file

<p align="center">&nbsp;</p>
<p align="center"><b>Today</b>: [date,today,month]/[date,today,day]/[date,today,year]</p>
<p align="center"><b>Yesterday</b>: [date,yesterday,month]/[date,yesterday,day]/[date,yesterday,year]</p>





$lay=new IS_Layout($html);

// First Argument in replace function are ever the reference of variable in HTMl file

$lay = null; // add this to prevent memory problems

Any comments is appreciated.