[dokuwiki] Re: Large memory requirements

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 28 Jan 2011 23:47:18 +0000

On 28 Jan 2011, at 12:39, Chris Tapp wrote:

> On 28 Jan 2011, at 11:41, Michael Hamann wrote:
> 
>> Hi,
>> 
>> Excerpts from Christopher Smith's message of 2011-01-28 12:27:07 +0100:
>>> On 28 Jan 2011, at 10:57, Chris Tapp wrote:
>> [...]
>>>> Is there any way to profile the code so I can see where the memory is 
>>>> getting used?
>> 
>> I've found
>> http://morefedora.blogspot.com/2008/05/profile-memory-usage-of-php-scripts.html
>> and that seems to work quite well also with current PHP/xdebug versions.
> 
> Thanks guys.
> 
> I had just found out about the circular reference issue myself, but I don't 
> __think__ my code has any. More checking required...
> 

Your probably right about _your_ code.  My guess, the circular reference is in 
DokuWiki's parser, probably between the handler and its call writer.

I looked into DW's memory usage a while back and found in normal operation the 
parser used twice the memory it should but couldn't figure out why, at the time 
I didn't know about the GC issue.

Its convoluted code, but after a quick glance, a fix maybe to add a new line 
clearing $Handler in the finalise() method.

722      function finalise() {
+          unset($this->Handler);
723      }

and something similar at the end of finalise() in all the other classes which 
implement the Call Writer interface (not that we have an interface defined :-) )

- Chris--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: