Re: PHP memory garbage collection
- From: Bert Melis <bert.melis@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 05 Apr 2005 17:55:59 +0200
Anze wrote:
Anybody? Please? I really need to solve this...
Is there a way to measure current memory consumption?
Regards,
Anze
Anze wrote:
Hi!
I have a script that uses a lot of memory and an ISP that has memory-limit set to 10 Mb. The script of course doesn't finish running. :(
The program is rather simple - it parses XML into an array and then starts the loop that inserts data into the database. If I use a very large XML file then the PHP crashes inside the loop (Fatal error: Allowed memory size of 10485760 bytes exhausted) - indicating that the problem lies within loop somewhere.
Can I trace memory consumption of a PHP script so I can determine where the memory is wasted?
If PHP uses all the memory (and frees nothing) until the end of the script then that could be the problem - is there any way I can force it to do garbage collection?
Any comment on how PHP uses memory would be appreciated - I would really hate to have to break the script into smaller pieces (or change ISP for that matter :) ).
Thanks!
Anze
I'm already thinking of a solution, my fault...
Look into your script for where you have global variables which you don't need anymore and then unset them (unset($var)).
If you can't solve it this way, you can contact your ISP to run the script for you through SSH or something.
I don't think you would run the script often or do you? If you do, I suggest thinking about the logic and effeciency about your piece of programming.
.
- Follow-Ups:
- Re: PHP memory garbage collection
- From: Anze
- Re: PHP memory garbage collection
- References:
- PHP memory garbage collection
- From: Anze
- Re: PHP memory garbage collection
- From: Anze
- PHP memory garbage collection
- Prev by Date: mail with pear... i don't understand...
- Next by Date: Re: PHP modules
- Previous by thread: Re: PHP memory garbage collection
- Next by thread: Re: PHP memory garbage collection
- Index(es):
Relevant Pages
|