Forum Moderators: coopster
Unfortunately, I get a fatal error:
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 6 bytes) in funcs_parse_emails.php on line 48
after only six emails. Clearly, if I am using up 42 megabytes, I have a serious problem.
Is there someone out there who can point me to a book or website that discusses PHP memory management issues or provides tools I can use? Alternatively, is there someone who has expertise in this area who would be willing to help me?
Thank you,
Mel
Looks to me like you are continually loading up code in an include() or else you are populating more and more variables. One way or another you are loading up your memory allocation. Are you running a loop that continually includes() another file or something that may be quite large?
Are you aware of any tools that can help me debug to see where the memory is being allocated?
If I reset a variable to an empty string, does that free the memory? Is there another way to free memory that I do not allocate explicitly?
Thanks.
Mel
I found the PHP function memory_get_usage, and by putting in a bunch of echo statements, I was able to determine where my problem was. (It turned out to be an "=" instead of an "==" in a conditional, which resulted in an endless loop. It's always something trivial, isn't it?)
For those of you facing memory usage problems, this function (memory_get_usage)is great.
Mel