Jump to content

[SOLVED] Out of memory


maddogandnoriko

Recommended Posts

My script is importing a 400-500k xml file and putting it into an array. I am getting an error:

 

Allowed memory size of 8388608 bytes exhausted (tried to allocate 40 bytes) in /Applications/MAMP/htdocs/VideoMainframe/includes/classes/simplexml.php on line 282

 

I know what it means I think, out of 8megs of memory. Something is wrong. Is there a way to determine how much memory a script is using? Like echo or print the value so i can try to see where the memory spikes up? Also...any hints on tracking this error would be a great help. I will look for infinite loops, but a quick look revealed none. Is there a way to print ALL vars available to the script? Maybe I can spot it that way... Oh yeah I changed all of my requires to require_once too. There is too much code in too many files to post yet.....until I can narrow the problem down.

 

 

thank you very very much,

                                        maddogandnoriko

Link to comment
https://forums.phpfreaks.com/topic/151769-solved-out-of-memory/
Share on other sites

Your code is either doing something that directly consumes a lot of memory or it has a logic error, like a loop that never ends, that causes all available memory to be consumed.

 

Posting your code would be the quickest way for someone else to determine the most likely cause.

Link to comment
https://forums.phpfreaks.com/topic/151769-solved-out-of-memory/#findComment-797745
Share on other sites

I was using a simplexml class that was created for ph pre5.xx. I have decided to abandon that and use php5. For loading a large(ish) file like 400-500k, which would take up less memory, simplexml or xml_parser? I really can't post the code it is spread across a number of includes and classes. I am trying to narrow it down a bit so I can post the offending code.

 

maddogandnoriko

Link to comment
https://forums.phpfreaks.com/topic/151769-solved-out-of-memory/#findComment-797871
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.