[Solar-talk] Memory problems

Jeff Moore jeff at procata.com
Tue Nov 13 18:32:00 CST 2007


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.

Best Regards,

Jeff


More information about the Solar-talk mailing list