Exhaust of memory when creating large cache
Closed this issue · 5 comments
Having 14305 products will freeze zencart (or exhaust allocated memory on server) on language switch to newly installed language when usu starts creating cache for the names.
In this case includes/classes/usu.php, Line: 1155
Calls zen_get_products_name() 14305 times in a loop, which generates 14305 queries to database.
Thanks for the report! I'll be getting to the USU issues in a couple of weeks and will be looking to you to help me validate my solution.
FWIW, I've reviewed the current handling of the caching and am of the opinion that it's hurting performance (and potentially memory consumption) more than it's helping.
For v3.1.0 and later the caching will be automatic and on a per-page basis. That will help performance in the determination of any category, product, manufacturer and ez-page names that are used in multiple spots on a specific page.
From the, albeit on teeny sites, profiling that I've done, using a per-page cache to not re-determine the various names seems to have a similar performance to the current 'mass' calculation ... without the possible out-of-memory conditions that the current implementation raises.
I finally had the time to install this on the customers site, and can verify that it now works with a large product database.
Thanks for taking the time to let me know that the update did, in fact, correct your issue!