As part of my work restructuring the background daemons, I'm starting to
do memory profiling on StatusNet... I'd like to get it to the point
where we can enable a debug mode that just snapshots out how much memory
each class and global takes up while you're running.
I've already found some low-hanging fruit in DB_DataObject. This is a
"clever" library that likes to stash a lot of stuff into a global
$_DB_DATAOBJECT array, including all your query result data.
Sure you've got a free() method, but nobody calls those consistently...
I found I could quite easily drop a destructor onto our
Memcached_DataObject intermediate class which calls the free() method
when the object is destroyed (explicitly with an unset(), or implicitly
by falling out of scope and no longer being referenced).
My queue-handler daemon was able to get through an average of 595
notices on my stress test before croaking on a 32M memory_limit, but
jumped up to get through 761 notices simply by adding this one-line
destructor.
Not bad for a start!
I've committed the destructor onto 0.9.x branch.
-- brion vibber (brion @ status.net)
_______________________________________________
StatusNet-dev mailing list
[email protected]
http://lists.status.net/mailman/listinfo/statusnet-dev