Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Allowed memory size.. but I have allocated tons of memory for my script.
#1

[eluser]laytone[/eluser]
Fatal error: Allowed memory size of 104857600 bytes exhausted (tried to allocate 16 bytes) in /var/www/vhosts/XXXXXXXX/httpdocs/system/database/drivers/mysql/mysql_result.php on line 162

Notice allowed memory is 100 megs, tried to allocate 16 bytes.

I'm trying to pull a HUGE list of people from a mysql database.

How can I solve this problem? Anybody come across this issue before?

thanks in advance.

Layton
#2

[eluser]Jelmer[/eluser]
The error means the full 100 megabytes has been exhausted (as it says). It's not that it crashes on 16 bytes, it crashes after having used 104857600 bytes and trying to use 16 bytes more.
Apparently the list is so incredibly huge 100mb isn't enough to handle your data.

You didn't give any details, but in general 100mb is an insane amount of memory - especially when it's about text and not images.
#3

[eluser]WanWizard[/eluser]
I could easily replicate that, so I think I understand the issue.

I had a form with a dropdown with all site members. I needed to select them all (only ID and name), store them in an array, feed the array to the view, have the view cached by the output buffering in the output class. I had enough members on this site to have this use 32M (which was the app limit at that time).

No more issues since I've switched to jQuery to pull them dynamically from the database using an autocomplete function.

I short, don't pull huge amounts of data from the database. If you do that, chances are your approach to the problem is wrong. Rethink your solution.
#4

[eluser]bl00dshooter[/eluser]
BTW, how many users are we talking about? 100mb is a lot of memory.

If the data is not sensitive like passwords or so, you could member save it to a text file, and read the data from there. Then, you can update the text file with the contents of the database every 6 hours or so. I'm not quite positive, but I believe it takes less memory to read a text file then to interact with a database.
#5

[eluser]joedy[/eluser]
I agree with all the answers before, but if you insist put this function before you process the data
ini_set("memory_limit", "128M");
#6

[eluser]laytone[/eluser]
ini_set(“memory_limit”, “100M”); is why its at 100M... default is 8 or 16

I'm trying to pull about 104,144 records. Even though that's a lot, I don't see it exceeding 100 MB.

Anyway, unless anyone has a better idea, I am going to modify my script to select one day at at time, append them to a file, then send it for download.


Thanks for the help everyone.

P.S.
WanWizard: Thank you, you are absolutely correct. A new approach is very much a necessity.




Theme © iAndrew 2016 - Forum software by © MyBB