mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
fix memory leak
This commit is contained in:
@@ -275,11 +275,13 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
|||||||
Smarty_Internal_Debug::end_compile($this);
|
Smarty_Internal_Debug::end_compile($this);
|
||||||
}
|
}
|
||||||
// release objects to free memory
|
// release objects to free memory
|
||||||
foreach (Smarty_Internal_TemplateCompilerBase::$_tag_objects as $i => $d) {
|
Smarty_Internal_TemplateCompilerBase::$_tag_objects = array();
|
||||||
unset(Smarty_Internal_TemplateCompilerBase::$_tag_objects[$i]);
|
$this->compiler_object->parser->root_buffer = null;
|
||||||
}
|
$this->compiler_object->parser->current_buffer = null;
|
||||||
unset ($this->compiler_object->parser->root_buffer,$this->compiler_object->parser->current_buffer,$this->compiler_object->parser,
|
$this->compiler_object->parser = null;
|
||||||
$this->compiler_object->lex,$this->compiler_object->template,$this->compiler_object);
|
$this->compiler_object->lex = null;
|
||||||
|
$this->compiler_object->template = null;
|
||||||
|
$this->compiler_object = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -87,23 +87,15 @@ class Smarty_Internal_Utility {
|
|||||||
echo ' is up to date';
|
echo ' is up to date';
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
// free memory
|
|
||||||
foreach ($this->smarty->template_objects as $key => $d)
|
|
||||||
{
|
|
||||||
unset($this->smarty->template_objects[$key]);
|
|
||||||
}
|
|
||||||
$this->smarty->template_objects = array();
|
|
||||||
foreach ($_tpl->smarty->template_objects as $key => $d)
|
|
||||||
{
|
|
||||||
unset($_tpl->smarty->template_objects[$key]);
|
|
||||||
}
|
|
||||||
$_tpl->smarty->template_objects = array();
|
|
||||||
unset($_tpl);
|
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
echo 'Error: ', $e->getMessage(), "<br><br>";
|
echo 'Error: ', $e->getMessage(), "<br><br>";
|
||||||
$_error_count++;
|
$_error_count++;
|
||||||
}
|
}
|
||||||
|
// free memory
|
||||||
|
$this->smarty->template_objects = array();
|
||||||
|
$_tpl->smarty->template_objects = array();
|
||||||
|
$_tpl = null;
|
||||||
if ($max_errors !== null && $_error_count == $max_errors) {
|
if ($max_errors !== null && $_error_count == $max_errors) {
|
||||||
echo '<br><br>too many errors';
|
echo '<br><br>too many errors';
|
||||||
exit();
|
exit();
|
||||||
|
Reference in New Issue
Block a user