-1

Possible Duplicate:
Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php

hi, i m tring to run the program, but I keep getting this error; Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 12 bytes) plz, help me

Community
  • 1
  • 1

6 Answers6

3

Here is a simple tutorial here it will work.

This error message can spring up in a previously functional PHP script when the memory requirements exceed the default 8MB limit. Don’t fret, though, because this is an easy problem to overcome.

To change the memory limit for one specific script by including a line such as this at the top of the script:

ini_set("memory_limit","12M");

The 12M sets the limit to 12 megabytes (12582912 bytes). If this doesn’t work, keep increasing the memory limit until your script fits or your server squeals for mercy.

You can also make this change permanently for all PHP scripts running on the server by adding a line like this to the server’s php.ini file:

memory_limit = 12M

Keep in mind that a huge memory limit is a poor substitute for good coding. A poorly written script may inefficiently squander memory which can cause severe problems for frequently executed scripts. However, some applications are run infrequently and require lots of memory like importing and processing a big data file.

In case you need any more help please do not hesitate to reply here.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
0

There might be running infinite loop paste your code here for better answer

Maulik Vora
  • 2,544
  • 5
  • 28
  • 48
0

Locate your php.ini file and edit the memory_limit field

jab
  • 2,844
  • 1
  • 21
  • 22
  • thanks, actually i wil incresses the memory_limit,but in my file system there are so many php.ini files, dat's why its not working. so what should i do now? help me! – Amol Deshpande Sep 08 '10 at 09:42
  • @amol Wich OS are you using? In Windows It's usually located in c:\Windows in linux systems may vary – jab Sep 08 '10 at 10:14
  • As Pekka has said, use phpinfo() to locate the actual php.ini file that is being used – Mark Baker Sep 08 '10 at 10:28
0

Increase max_memory in your php.ini file.

slayerIQ
  • 1,488
  • 2
  • 13
  • 25
  • Thanks, actually i wil incresses the memory_limit,but in my file system there are so many php.ini files, dat's why its not working. so what should i do now? help me! – Amol Deshpande Sep 08 '10 at 10:00
  • @amol as I said above, use `phpinfo()` to find out which php.ini is used on your system. – Pekka Sep 08 '10 at 11:57
0

Either increase the memory limit defined in php.ini, or rewrite your code to use less memory (e.g. by freeing up resources or variables that won't be cleaned automatically by PHP's garbage collection), or give us more detail so that we can try to help. "trying to run the program" doesn't really tell us much, eg. what program?

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • thanks, actually i wil incresses the memory_limit,but in my file system there are so many php.ini files, dat's why its not working. so what should i do now? help me! – Amol Deshpande Sep 08 '10 at 10:00
  • Current it's set to 32MB, but simply increasing that limit doesn't really resolve your problem, just hides it. It's better to try and identify what is using so much memory. – Mark Baker Sep 08 '10 at 10:30
0

Before you change the memory limit you should check if your code needs that much memory in the first place. It's a very unusual scenario for that to be the case - usually this is an indicator of:

1) incorrect config elsewhere, e.g. in webserver

2) inefficient management of resources in your code

3) unbounded loops/recursion

symcbean
  • 47,736
  • 6
  • 59
  • 94