I have a PHP routine that I call shell_exec to traverse my own website and build an index.
However since I do this multi-threaded I have been running into problems with memory storage…server memory spikes to 250MB then back down to 100MB randomly.
I am constantly accessing the mysql database during this time; and the php slows down.
Is this possible using php or should I use jsp/java.
PHP uses a reference counting for memory management. As long as there is a variable declared (could be an array or global) that can be used to access that variable then it is never freed.
The solution is to call
unset()on anything that has already been used. To make it use much less memory the parts of the index that have been created should be stored in a sql database. This allows much more data can be unset.In short this can be done in PHP or JSP and use much less memory by using a database.