Maybe you're actually bloating the cache that's created when you use $database->prepare_cached(). I suppose that would depend on how many lines of input this script sees.
I wonder why you would even want to cache the results of SQL statements such as CREATE TABLE IF NOT EXISTS. Does this help? I would have guessed that the cache was more useful more SELECT queries.
Anyway, as a longshot, try turning those into $database->prepare() instead, and see if it helps any.
Even better, substitute placeholders for the variables. That way you can prepare() the statements once and execute() them with the correct parameters each timne through the loop. It may not affect the memory leak, but it's useful in many ways.
buckaduck
In reply to Re: Clean Code - What a mess...
by buckaduck
in thread Clean Code - What a mess...
by PyroX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |