Memory Problems

I’ve been making up an include file in php containing a large array of around 500 entries, and I’ve run up an error message when trying to use it?

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /home/a6213432/public_html/troops.inc on line 58

The file is here if that’s helpful.

I understand that arrays are very memory intensive on php, but ~67Mb seems like a lot! Does anyone know what the problem is?

I realize that this is more of a workaround than a direct solution, but have you considered moving that data to a SQL database? Limitations aside, there are some fairly easy tutorials out there…

And I certainly have no idea how that little data could become 65+ megabytes in memory or any other context. Do you have any program that can check your syntax\ spit out your structures in memory?

Perhaps (and I have not looked all that closely) you are nesting the array improperly so it gets repeated unnecessarily. Double check it if you haven’t. That would be a hec of a repeat…

Don’t have time to think about anything else today, sir…

I’m afraid I’m new to php (and this type of programming), so I don’t have any programs like that.

There’s certainly a lot of arrays within arrays, and a few basic for loops at the end to add a bit of extra data, but i don’t think theres any repeats.

Hello,

The forum search is the most recommended and quick to find a solution:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 7680

That seems to have workied for the other guy, but I don’t have a file called config.php. Should i put it in the .htaccess file or make a new file called config.php?

Out of interest, it sounds like that’s increasing the allowable amount of memory, but it still doesn’t explain why it’s necessary.