rares_dumitrescu
asked on
Fatal error: Out of memory
I have a problem, i am using a php script file to generate something and put in my mysql db, the problem is that the info is very much and i get something likt this :
Fatal error: Out of memory (allocated 503054336) at /usr/ports/lang/php5/work/ php-5.2.3/ Zend/zend_ hash.c:610 (tried to allocate 1048576 bytes) in /usr/home/gtoplive/public_ html/php/i nc/__mysql .php on line 375
How can i compress or do something to reduce the memory allocation ?
Fatal error: Out of memory (allocated 503054336) at /usr/ports/lang/php5/work/
How can i compress or do something to reduce the memory allocation ?
I would need a little more specific information about what you're trying to do but in general, the approach is going to probably be to break up the job and do one piece at a time. For example, if you are reading 1000 records into memory, altering the values, and writing them back to the database, then instead of reading all 1000 into an array you would instead read one record, alter it, and write it back to the database - and then loop to do that 1000 times.
Can you give me a little more detail about how the logic of your script works and what kind of data you're reading into PHP?
Can you give me a little more detail about how the logic of your script works and what kind of data you're reading into PHP?
ASKER
The scripts works like this...
I get from db about 250 000 records, and then i combine the information from it in a array, afther that i read the array and insert into another table...
I get from db about 250 000 records, and then i combine the information from it in a array, afther that i read the array and insert into another table...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#2 Use ini_set('memory_limit', '-1'); to disable the memory limit.
#3 Write to a file rather than store it in a variable.