Hi,

I am not aware of a good way of debugging memory issues in PHP yet. Can anyone 
recommend a free profiler or the like? As for your problem, there is a general 
tendency of PHP to hoard memory during (very) long runs. This is a known bug 
that apparently can only be avoided by re-engineering the object dependencies 
in affected code [1]. However, without a proper memory profiling, I have no 
feasible approach for finding out where this should be done.

Of course, it is also possible that some other problem causes memory to be 
eaten without PHP being to blame. Usually this is caused by look-up arrays 
that are used as caches in PHP. For example, MediaWiki has a LinkCache that 
can grow without control; if you do long runs that may (indirectly) use this 
cache, then it is required to purge it manually from time to time. Again, 
there might be further such problems, though I have tried to limit all caches' 
size in SMW. Ideas for better debugging are welcome.

Regards,

Markus

[1] http://paul-m-jones.com/?p=262


On Mittwoch, 7. Januar 2009, zehet...@molgen.mpg.de wrote:
> Hi,
>
> I wonder if anyone can tell me if the functions used when I call
> SMWQueryProcessor::getResultFromQueryString should release all the memory
> after they finished?
>
> I thought I could avoid a memory problem by calling
> getResultFromQueryString with different 'offset' values to retrieve smaller
> chunks of articles. However, at some point I still run out of memory during
> the loop, even if I just call the function and ignore the result.
>
>   $maxresults = 500;
>   $limit = $params['limit']; # is 10
>   for ($ofs = 0; $ofs < $maxresults ; $ofs += $limit) {
>       $params['offset'] = $ofs;
>       $dummy =  SMWQueryProcessor::getResultFromQueryString($querystring,
> $params, $printouts, SMW_OUTPUT_WIKI);
>   }
>
> When $ofs reaches 490 I run out of memory (Fatal error: Allowed memory size
> of 134217728 bytes exhausted).
>
> The test query is '[[MyProp::~*;?;?]][[Category:MainArticle]]' with about
> 19000 articles matching (as using [[MyProp::?;?;?]] gives the error 'The
> value of property "MyProp" was not understood', I have to replace one '?'
> with '~*').
>
> MediaWiki 1.13.1
> PHP 5.2.1
> MySQL 6.0.45
> SMW 1.5a SVN
>
> Thanks,
> Gu
>
>
>
>
> ---------------------------------------------------------------------------
>--- Check out the new SourceForge.net Marketplace.
> It is the best place to buy or sell services for
> just about anything Open Source.
> http://p.sf.net/sfu/Xq1LFB
> _______________________________________________
> Semediawiki-devel mailing list
> Semediawiki-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


-- 
Markus Krötzsch
Semantic MediaWiki    http://semantic-mediawiki.org
http://korrekt.org    mar...@semantic-mediawiki.org

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to