[Solar-talk] Memory problems

Paul M Jones pmjones at ciaweb.net
Tue Nov 13 19:15:09 CST 2007


On Nov 13, 2007, at 6:32 PM, Jeff Moore wrote:

>
> On Nov 13, 2007, at 7:12 PM, Paul M Jones wrote:
>
>> Hi Jeff,  good to see you here.  :-)
>
> Good to be here.  :)
>
>> Do you think it would sufficient and wise for the free() method to  
>> call __destruct() internally, or for __destruct() to call the free 
>> () method internally?
>
> I think any involvement of __destruct() invites confusion.  One  
> problem with free() calling __destruct is that when you call unset  
> on the last reference to the object, php will call __destruct() a  
> second time.  I think any time you call __destruct manually will  
> result in the method being called twice on that object.  Thats  
> probably not good.  There is so much voodoo involved with __destruct 
> (), especially in the state of the system as things are shutting  
> down, I just think a separate free() operation would have less  
> opportunity for problems.

Good call.  I'll change things around internally with that in mind;  
thanks for the clear thinking.




--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the Solar-talk mailing list