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:xampphtdocsEditrackervendorsymfonysymfonysrcSymfonyComponentHttpKernelProfilerFileProfilerStorage 中,允许的内存大小为 1073741824 字节(试图分配 3358976 字节)第 153 行
OutOfMemoryException: Error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 3358976 bytes) in C:xampphtdocsEditrackervendorsymfonysymfonysrcSymfonyComponentHttpKernelProfilerFileProfilerStorage.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();
}
您也可以在配置中设置全局参数:
You can also set global parameter in config:
framework:
profiler:
collect: false
这篇关于symfony 内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!