On 10/24/05, Lonnie Olson fungus@aros.net wrote:
On Oct 21, 2005, at 5:32 PM, Christopher A. Watford wrote:
1 copy for the function call 1 copy for the return from str_replace
But the copy for the function call os str_replace() should be destroyed when the function returns, and the return value should *replace* the already existing copy in $message.
Just because the str_replace memory is no longer being used does not mean PHP removed it from the current page's working memory set. PHP is lazy to speed up allocation and page runtime.
This is a case for pass-by-reference.
I agree that there should be some more memory used in between memory checks, but the *net* change should be zero or less, depending on the existence of "\r"'s.
--lonnie
-- Christopher A. Watford christopher.watford@gmail.com