PHP Problem

BeTuned

New Member
Messages
3
Reaction score
0
Points
0
Hi,

I'm new to x10hosting but not into web development (also, i know CpanelX very well). Anyway, to the point.

I'm creating a script for an online game to look up stats, the script creates a PNG image (a map) that can be viewed by everyone.

I tested it on my local server and it worked, but now i uploaded it i'm having a Fatal Error.

Code:
[B]Fatal error[/B]:  Allowed memory size of 50331648 bytes exhausted (tried to allocate 42 bytes) in [B](...)[/B]
I know, this is a memory problem and you will think i need to increase my memory limits (request panel etc...), I already did this and i'm now on PHP level 2 (gives me 42 megs of working space).

The exact point is, the memory the script needed is only maximum 20MB (needs to read 3 files and put them into an image once a day).

I tested how many memory is needed with the following script line and tested multiple times:
PHP:
ini_set("memory_limit","20M");
Gives:
Code:
[B]Fatal error[/B]:  Allowed memory size of 20971520 bytes exhausted (tried to allocate 35 bytes) in
I increase the memory:
PHP:
ini_set("memory_limit","32M");
Gives:
Code:
Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 45 bytes) in
What should be the problem? Do i still have not enough memory or is there a serious bug in the script?

Cheers.

(I won't post direct links to prevent abuse at the servers, it's a relatively heavy script)
 

cowctcat

New Member
Messages
401
Reaction score
0
Points
0
I dont think i have ever heard of this happening before. i would make sure that you are freeing up resources you no longer need. Also make sure you didn't accidentaly trap yourself in an infinite loop (i've done this a couple times oops) or a really long loop. Also be carefull not to use too much memory as there is a script in all of the servers that automaticly temporarily suspends your acount for like a couple minutes. Thats about all i got
 

BeTuned

New Member
Messages
3
Reaction score
0
Points
0
I always try to limit my memory use, but it needs to process several .txt files (normally 3)... i will keep on trying to find the problem. Thanks for the reply.
 
Top