[dokuwiki] Re: Large memory requirements

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 28 Jan 2011 11:27:07 +0000

On 28 Jan 2011, at 10:57, Chris Tapp wrote:

> I have my own plugin that is sometimes using more than 256MB when it runs. It 
> does process many hundred pages, but I don't think it should be using this 
> much !
> 
> Is there any way to profile the code so I can see where the memory is getting 
> used?
> 
> The code may trigger a call to p_cached_instructions() for each page that it 
> processes, if that helps.
> 
> Chris Tapp
> 
> opensource@xxxxxxxxxxxx
> www.keylevel.com
> 


You could, log calls to memory_get_usage() at various parts in your code

There is a patch to xdebug which records memory usage and allows you to see it 
in your profile. I use the xdebug profiler but I've not used the patch, more 
details at http://xdebug.org/archives/xdebug-general/1228.html

Php has poor object garbage collection up to 5.3.  Objects with circular 
references wouldn't have their internal reference counters decremented to zero, 
so the objects would remain and memory usage will grow and grow and grow. See 
http://www.ibm.com/developerworks/opensource/library/os-php-5.3new1/#N101D4
http://paul-m-jones.com/archives/262

For me, memory usage issues have pretty well always been down to the garbage 
collection issue, so I can track memory usage in 'top' - it just keeps growing 
- and haven't needed other strategies.

If you can't upgrade to 5.3, add code to break the circular reference before 
discarding the object.

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

Other related posts: