nrueckmann / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

Fatal error(E_ERROR): Out of memory (allocated 837550080) (tried to allocate 257206523 bytes) when use SECTION but foreach does not been #200

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use Section of smarty show data to template. Array data 50 main elements and 
with each main elements have 10 elements
2. Server have Fatal error: Out of memory.
3. Use Forech of smarty replacement Section. not error Out of memory

what is differences in performance of the two methods ? 

Original issue reported on code.google.com by huutho.tp@gmail.com on 17 Sep 2014 at 4:40

GoogleCodeExporter commented 8 years ago
{foreach} is much faster and uses much less memory.

{section} is a monster. It creates all of the property variables like 
$smarty.section.row.index and others for each section and does update it's 
value on each iteration.

{foreach} does create it's property variables only if they are used in the 
template.

Original comment by Uwe.Tews@googlemail.com on 17 Sep 2014 at 5:40