Memory leak

Project:phpAlbum.net
Version:0.4.1-14_fix06
Component:Code
Category:bug
Priority:critical
Assigned:Unassigned
Status:new
Description

We have a fairly large amount of images (27G, 12631 files). Using the scan directory (or worse, the automated scanning runs once per day) the memory is leaking and php runs out of memory.
I have a guess for the leaking:
The database queries always use create_function for the where and order by clauses. This way it creates an enormous amount of functions that fill up the memory (ref.: http://bugs.php.net/bug.php?id=6333).
I gave a shot implementing some caching, but most of the orders, sets and wheres are unique, so it did not make much sense.

Edit:
PHP Version 5.2.6-1+lenny4


style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8698264690166658"
data-ad-slot="4417389723">