PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |
Old November 9th, 2010, 03:36 AM   #1 (permalink)
Member
Verified Customer
 
Join Date: Sep 2010
Posts: 110
PHP memory allocation

Normally I run PHP memory at about 32mb and this has been ok for years. I've just noticed that our members gallery gives me a PHP error seeminglly because it cannot cope with the number of categories, but I was shocked to see what the script was attempting to allocate. Here is the error:
Quote:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 765725 bytes) in /home/xxxx/public_html/forum/includes/functions.php(6875) : eval()'d code on line 106
Is there a realistic solution to this because allocating such a huge amount to one script is so unusual.
Steff is offline   Reply With Quote
Old November 9th, 2010, 03:54 AM   #2 (permalink)
Member
Verified Customer
 
Join Date: Sep 2010
Posts: 110
OK I've set Categorybit Options> Depth of Categories to 1 for now and the script works within the 32mb allocation.
Is there a way around this so that I can show the depth of two?
Steff is offline   Reply With Quote
Old November 9th, 2010, 06:45 AM   #3 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 1,229
Well at first sight, its not the categories...
but that doesnt mean anything..
functions.php line 6875 is a hook called global complete. There, gallery does only one thing: it sets the users location for "badlocation" if a page is no known by the system. (used in who is online and profile) thats only 4 lines. That hardly takes any memory. So as you have at least 105 lines on that hook, it must be an other plugin at that location.



It could of course be, that your memory is so full that a teeny weeny bit will be the straw that breaks the camels back..

But I doubt it: as a matter of fact, I do not understand why setting the category depth differently would change anything there... (it must be something else, and changing the cat depth would trigger that "something else)

Because, ALL your categories, names, ids, options, etc,, are saved in datastore cache.
They are only fetched from there in a plugin, way before that hook.
It is one serialized array.

And

They are ALL fetched, in one array, no matter what depth you have for display.

It could of course interfere on gallery index page, if you have a lot of cats to render, but only on index page and memory should not be exhausted on the location it is exhausted.

What I suspect, is that you might have another hack using the global_complete hook, doing lots of stuff. (adding that to vbgallery might use to much memory)
Check your plugin manager. search for hook global_complete. (in other products than vbgallery)
you could disable those if they are not needed in vbgallery by making them optional.
Example:
Code:
Content visible to verified customers only.
thats just an idea..

Luc

PS: How many cats do you have?

Last edited by Luciano; November 9th, 2010 at 07:02 AM.
Luciano is offline   Reply With Quote
Old November 10th, 2010, 04:13 AM   #4 (permalink)
Member
Verified Customer
 
Join Date: Sep 2010
Posts: 110
Hi Luciano,
Thank you for the interesting theory.
The error was generated only on the index page and interestingly enough vanished when I changed to single cat level. Also if you jumped straight to a cat rather than open the index page there was no error. I do accept that there could well be another plugin that could be playing up.
I'll look into this a little more and if I do find the culprit I will post the details here.
I have about 50 cats and possibly about 600 subcats all showing on the index page.
Anyway for now I have increased the php memory as I am working on the gallery, but later I will reduce the memory down to so 40mb as I feel that should be more than ample to cope with the gallery.
Steff is offline   Reply With Quote
Old November 10th, 2010, 12:33 PM   #5 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 1,229
Well it seems to be the addition of things...
if you have like 600 subcats then it is lets say "normal that you need more memory".

Why? because the cats..(all 650) are fetched from cache in one big array.. (thats ok..)
then on index the program goes through that array, fetching the subcats for each top category, and placing the title and the link in a template and then rendering that template and placing the rendered stuff in a variable to be outputted in html.
Its like you would be processing 600 pictures to be outputted on each page...

My suggestion, change your structure.
instead of having a 2 level structure like:
Top category
------ sub cat level 1

make a 3 level structure like
Top category
------ sub cat level 1
---------------subcat level 2

and only display 2 levels...

that will lower the memory usage and still give your users a better overview.

-----------------

You should still check the other plugins (and maybe add conditionals) to save extra memory.

Luc
Luciano is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fatal error: Allowed memory size in ..../image-inc.php mvandiermen General Discussion 5 May 5th, 2010 01:17 PM
Out of memory Halfhidden PhotoPost Pro Support Forums 5 November 1st, 2009 04:02 PM
PHP + GD memory error DesmondSweeney Photopost Pro Installation & Upgrades 16 September 22nd, 2006 10:48 AM
allowed memory size for image-inc.php? DragonWarden Photopost Pro How Do I...? 2 February 21st, 2006 09:48 AM
PHP Memory Error - Upload 2 or more files DesmondSweeney Photopost Pro Installation & Upgrades 1 January 31st, 2006 04:56 PM


All times are GMT -5. The time now is 09:03 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0