Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Static Publishing - memory issue - FileSystemPublisher/Director

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 902 Views
  • BigJohn
    Avatar
    Community Member
    3 Posts

    Static Publishing - memory issue - FileSystemPublisher/Director Link to this post

    I've got some serious performance problems with Silverstripe so I hoped to find a solution in static publishing my site. When performing .../dev/buildcache?flush=1 I get an 'out of memory' error.

    Because I don't understand why such a simple action should take lots of memory I tried to analyse the code. It seems that the following line in cms/code/statispublisher/FileSystemPublisher.php is responsible for the increase in memory:
    $response = Director::test($url);
    This lines eventualy calls Director::handleRequest(...) so the real issue goes deeper.

    You can see what's happening if you just call this method multiple times for the same url. Then you see the memory usage grow:
    for($i=0;$i<100;$i++) {
        echo "--- iteration $i with memory usage: " , memory_get_usage() , "\n";
        $response = Director::test($url);
    }
    break;

    The outpout shows:
    --- iteration 0 with memory usage: 17106200
    --- iteration 1 with memory usage: 20147872
    --- iteration 2 with memory usage: 20350432
    ...
    --- iteration 98 with memory usage: 39963656
    --- iteration 99 with memory usage: 40166176

    Is it possible this is a memory leak in a static function? Is there a simple workaround available?

    using:
    php 5.2.11
    Sivlerstripe 2.3.3

    902 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.