Granted this is "PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli)", but my fondness for PHP is nonetheless waning...
<?php
print memory_get_usage()."\n";
Simple enough. But sporadically, I get:
apang@olympus:/tmp$ php test.php
51568
Segmentation fault
That doesn't instill a lot of confidence when you're trying
to figure out where your long running PHP script is leaking
memory like a sieve...
Wait there's more.
<?php
print memory_get_usage()."\n";
print memory_get_usage()."\n";
You'll have to dig into the Zend Engine internals to figure
this out:
apang@olympus:/tmp$ php test.php
51944
52248
I'm presuming there's some voodoo Zend Engine optimization
going on under the hood (as opposed to some observer effect).