Click to See Complete Forum and Search --> : Fatal error: Allowed memory size
greed83
12-04-2008, 09:09 PM
Hey All,
I'm having an issue with a few cms/blog applications. I currently have shared hosting and my allowed memory is 32MB. I have spoken with my host and they say they cannot raise it. My big issue comes when I try and use photo gallery apps. I always get the "Fatal error: Allowed memory size...blah blah blah". Currently I am attempting to use Silverstripe(which aside from being slow at times, runs great, unless i try and upload images), and Plogger(which i cannot upload any image regardless of size, even 100K).
My actual error is as follows:
Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/grasree6/public_html/testing/ploggerb3/lib/exifer1_5/makers/olympus.php on line 155
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268632065 bytes) in /home/grasree6/public_html/testing/ploggerb3/lib/exifer1_5/makers/olympus.php on line 155
I've looked into everything and I'm quite certain it is just my hosts allowed memory.
I guess my real question is can anyone suggest a good lite weight cms/photogallery tool that can work well on a 32MB shared hosting server?
Cheers and thanks again!
G
scragar
12-04-2008, 09:31 PM
huh, you're going over the ram limit by quite a bit, what code are you doing, either you need to rethink your logic, or you want to watch for infinite loops, which can be a real pain.
greed83
12-04-2008, 09:39 PM
I get that error when I try and upload a 1MB image through the Plogger interface. That large memory error is strange, and all my research points that it is not a plogger issue but a hosting issue. I'm defiantly not a coding expert. I'm more looking for a light weight cms/photogallery tool.
Thanks for the response!
scragar
12-04-2008, 09:46 PM
http://google.com/search?hl=en&safe=off&q=268632065+bytes+to+MB&btnG=Search
256 MB of ram doesn't sound like it's just a heavy environment, there is no logical reason for such a huge ram requirement, unless you are doing something daft with gd or whatever.
greed83
12-04-2008, 09:53 PM
I couldn't agree more lol. It very well may be a plogger issue i guess, but nothing i found in their documentation of message forums lead to a reason. Any suggestion of a better app?
scragar
12-04-2008, 10:04 PM
just wondering, but can you show the lines 150-160 or so of: /home/grasree6/public_html/testing/ploggerb3/lib/exifer1_5/makers/olympus.php
That's where your error messages are coming from, there might be something simple there that just needs a tiny edit.
greed83
12-04-2008, 11:55 PM
Thanks for the help. This plogger thing is a pretty complex app from what i can tell. here the bit o code that pertains to the line 150 error. I included the whole function.
//=================
// Olympus Special data section
//====================================================================
function parseOlympus($block,&$result,$seek, $globalOffset) {
if($result['Endien']=="Intel") $intel=1;
else $intel=0;
$model = $result['IFD0']['Model'];
$place=8; //current place
$offset=8;
//Get number of tags (2 bytes)
$num = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $num = intel2Moto($num);
$result['SubIFD']['MakerNote']['MakerNoteNumTags'] = hexdec($num);
//loop thru all tags Each field is 12 bytes
for($i=0;$i<hexdec($num);$i++) {
//2 byte tag
$tag = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $tag = intel2Moto($tag);
$tag_name = lookup_Olympus_tag($tag);
//2 byte type
$type = bin2hex(substr($block,$place,2));$place+=2;
if($intel==1) $type = intel2Moto($type);
lookup_type($type,$size);
//4 byte count of number of data units
$count = bin2hex(substr($block,$place,4));$place+=4;
if($intel==1) $count = intel2Moto($count);
$bytesofdata = $size*hexdec($count);
//4 byte value of data or pointer to data
$value = substr($block,$place,4);$place+=4;
if($bytesofdata<=4) {
$data = $value;
} else {
$value = bin2hex($value);
if($intel==1) $value = intel2Moto($value);
$v = fseek($seek,$globalOffset+hexdec($value)); //offsets are from TIFF header which is 12 bytes from the start of the file
if($v==0) {
$data = fread($seek, $bytesofdata);
} else if($v==-1) {
$result['Errors'] = $result['Errors']++;
}
}
$formated_data = formatOlympusData($type,$tag,$intel,$data);
if($result['VerboseOutput']==1) {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
if($type=="URATIONAL" || $type=="SRATIONAL" || $type=="USHORT" || $type=="SSHORT" || $type=="ULONG" || $type=="SLONG" || $type=="FLOAT" || $type=="DOUBLE") {
$data = bin2hex($data);
if($intel==1) $data = intel2Moto($data);
}
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['RawData'] = $data;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Type'] = $type;
$result['SubIFD']['MakerNote'][$tag_name."_Verbose"]['Bytes'] = $bytesofdata;
} else {
$result['SubIFD']['MakerNote'][$tag_name] = $formated_data;
}
}
}
Cheers!
G
scragar
12-05-2008, 05:11 AM
Ah, looks like a corrupt text file, it's reading in an invalid size, that's why it throws the error at being unable to read in an invalid length of the file, causing it to run out of ram because it's caught in an infinte loop of loading a huge load of nothing from the text file.
I could be wrong, but it looks right, I've no idea how you would fix that however, I'm assuming deleting the text file won't just work...
greed83
12-05-2008, 10:24 AM
Thanks again for your input!
Although I'm not a "coder" i do understand how all this works for the most part. Can you point out where this text file is referenced? Maybe I can go to the Plogger forums with some informed questions and find a solution?
Cheers!
scragar
12-05-2008, 10:29 AM
The file name isn't mentioned in that function, by the looks of it the output of the file is fed into the function as the first argument.
I have no idea where the text file is mentioned or comes from, you will most likely have to ask on their forums or via an email to a member of their dev team about that, sorry I can't be any more help.
greed83
12-05-2008, 12:21 PM
Do not apologize my friend. Thanks so much for the help in the right direction! Cheers!