Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit def2ccb

Browse files
lmcdjfsimon
authored andcommitted
Add PHP memory_limit to WDT
1 parent 5ae0c82 commit def2ccb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{% set text %}
1111
<div class="sf-toolbar-info-piece">
1212
<b>Memory usage</b>
13-
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
13+
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} / {{ collector.memoryLimit == -1 ? '&infin;' : collector.memoryLimit }} MB</span>
1414
</div>
1515
{% endset %}
1616
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %}

src/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class MemoryDataCollector extends DataCollector
2323
{
2424
public function __construct()
2525
{
26-
$this->data = array('memory' => 0);
26+
$this->data = array(
27+
'memory' => 0,
28+
'memory_limit' => rtrim(ini_get('memory_limit'), 'M')
29+
);
2730
}
2831

2932
/**
@@ -44,6 +47,16 @@ public function getMemory()
4447
return $this->data['memory'];
4548
}
4649

50+
/**
51+
* Gets the PHP memory limit.
52+
*
53+
* @return integer The memory limit
54+
*/
55+
public function getMemoryLimit()
56+
{
57+
return $this->data['memory_limit'];
58+
}
59+
4760
/**
4861
* Updates the memory usage data.
4962
*/

0 commit comments

Comments
 (0)