symfony:如何检查bundle内存使用情况

时间:2015-09-22 22:57:49

标签: php symfony memory memory-management

在我的symfony应用程序中,当我在我的操作开始时或在app_dev.php的$response = $kernel->handle($request);之后转储php内存使用时,我得到它使用大约60Mb的内存。使用app.php时也一样。

我理解它太多了所以我试图理解如何纠正我的申请。

有没有办法可以为每个捆绑包转储内存使用量?我找不到一个简单的方法。

我的捆绑列表:

    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
            new FOS\ElasticaBundle\FOSElasticaBundle(),
            new FOS\UserBundle\FOSUserBundle(),
            new Genemu\Bundle\FormBundle\GenemuFormBundle(),
            new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
            new Ivory\OrderedFormBundle\IvoryOrderedFormBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle($this),
            new JMS\TranslationBundle\JMSTranslationBundle(),
            new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Liip\ImagineBundle\LiipImagineBundle(),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new Vipx\BotDetectBundle\VipxBotDetectBundle(),
            new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
            new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
            new Dizda\CloudBackupBundle\DizdaCloudBackupBundle(),
            new Liuggio\ExcelBundle\LiuggioExcelBundle(),
            new AppBundle\AppBundle(),

//            new Sonata\IntlBundle\SonataIntlBundle(),
//            new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
//            new Intaro\TwigSandboxBundle\IntaroTwigSandboxBundle(),
//            new WhiteOctober\TCPDFBundle\WhiteOctoberTCPDFBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new JMS\DebuggingBundle\JMSDebuggingBundle($this);
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new RaulFraile\Bundle\LadybugBundle\RaulFraileLadybugBundle();
            $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
        }

        return $bundles;
    }

1 个答案:

答案 0 :(得分:0)

您是否启用了Symfony的调试栏?您可以检查每个请求时间并找到使用情况,或者尝试blackfire.io作为@Perroin建议