symfony中的内存不足错误 [英] Out of memory error in symfony
问题描述
我目前正在从事Symfony项目(const VERSION ='2.5.10'),并且正在使用xampp. PHP版本是5.5.19.
I'm currently working on Symfony project (const VERSION ='2.5.10') and I am using xampp. PHP version is 5.5.19.
我的问题是,每当我运行开发环境时,都会出现错误:
My problem is everytime I run my dev environment I get an error :
OutOfMemoryException:错误:C:\ xampp \ htdocs \ Editracker \ vendor \ symfony \ symfony \ src \ Symfony \ Component \ HttpKernel \ Profiler \ FileProfilerStorage.php中的1073741824字节已用尽的内存大小(尝试分配3358976字节)第153行
OutOfMemoryException: Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 3358976 bytes) in C:\xampp\htdocs\Editracker\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Profiler\FileProfilerStorage.php line 153
,每次刷新页面时,它都会提供不同的内存大小.我还认为,这也是我的开发环境在刷新页面之前花费大量时间的原因.
and everytime I refresh the page it gives different memory size. I also think that this is also the reason why my dev environment takes a lont time before it refreshes the page.
感谢您的帮助.
php.ini
memory_limit ='256M'
memory_limit= '256M'
我试图增加内存限制,但仍然给出有关内存限制的错误
I tried to increase my memory limit,still it gives an error about memory limit
推荐答案
Symfony中最热切的组件是探查器.如果您不需要执行某些特定的事件探查器,则可以通过以下代码将其禁用:
The most eager component in Symfony is a profiler. If you don't need profiler in some particular actions you can disable it via code:
if ($this->container->has('profiler'))
{
$this->container->get('profiler')->disable();
}
您还可以在config中设置全局参数:
You can also set global parameter in config:
framework:
profiler:
collect: false
这篇关于symfony中的内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!