Unsetting Singleton Instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After finishing using an object I can free up resources by unsetting the
object eg.:

$object = new ClassName();

$var = $object->DoSomething();

unset($object);




However if I use a singleton instance of the class eg.

$var = ClassName::GetInstance()->DoSomething();

there doesn't appear to be anything to unset, but surely the instance
must take up some resources?




Does the instance disappear when the script terminates? I assume the
instance has a lifetime corresponding to the page which calls it and is
destroyed when the page is closed, but is it possible or necessary to
remove the instance from memory before the page is closed? And if so
how?

I have been unable to find anything on the net that deals with this
issue so any help on this subject would be much appreciated.




Thanks




[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux