Forum Moderators: coopster

Message Too Old, No Replies

PHP Memory usage.

PHP memory classes.

         

ucs308

2:00 am on Nov 20, 2003 (gmt 0)

10+ Year Member



I think I must be old. I have been producing a tonne of PHP, XML, XSL, and stuff, and now I'm looking at smarty, the php templating stuff.

I am creating a class that does a bunch stuff so I can display a page, with some headers and footers. I create this class once for each page loaded cos it has the stuff I need for headers etc. But..

When does the memory go away? Do I need to worry about this?

coopster

12:23 pm on Nov 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>When does the memory go away?

Do you mean, "when do the objects in memory go away?"

I believe when the object is destroyed, either with unset() or by simply going out of scope. You can check yours by using the functions listed on the Classes and Objects [us4.php.net] pages.

ucs308

12:23 am on Nov 21, 2003 (gmt 0)

10+ Year Member



Sorry I should have been clearer.

I have the following in my main page.

init_session();
$smarty = new Smarty_PageController;
$smarty->assign('name','WEB SITE);

I then have something like this..

<body>
<?php smarty->displayHeader()
smarty->displayBody()
smarty->displayFooter()?>
</body>

My question is when does smarty go away. Do I ** have ** to free it? And if so when? Where? If I do not explictly free it, when does it go away? Does it ever?