diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php
index d7d3ae13..3678a48c 100644
--- a/libs/sysplugins/smarty_internal_template.php
+++ b/libs/sysplugins/smarty_internal_template.php
@@ -275,11 +275,13 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
Smarty_Internal_Debug::end_compile($this);
}
// release objects to free memory
- foreach (Smarty_Internal_TemplateCompilerBase::$_tag_objects as $i => $d) {
- unset(Smarty_Internal_TemplateCompilerBase::$_tag_objects[$i]);
- }
- unset ($this->compiler_object->parser->root_buffer,$this->compiler_object->parser->current_buffer,$this->compiler_object->parser,
- $this->compiler_object->lex,$this->compiler_object->template,$this->compiler_object);
+ Smarty_Internal_TemplateCompilerBase::$_tag_objects = array();
+ $this->compiler_object->parser->root_buffer = null;
+ $this->compiler_object->parser->current_buffer = null;
+ $this->compiler_object->parser = null;
+ $this->compiler_object->lex = null;
+ $this->compiler_object->template = null;
+ $this->compiler_object = null;
}
/**
diff --git a/libs/sysplugins/smarty_internal_utility.php b/libs/sysplugins/smarty_internal_utility.php
index 63ffe5ea..b532e4a1 100644
--- a/libs/sysplugins/smarty_internal_utility.php
+++ b/libs/sysplugins/smarty_internal_utility.php
@@ -87,23 +87,15 @@ class Smarty_Internal_Utility {
echo ' is up to date';
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) {
echo 'Error: ', $e->getMessage(), "
";
$_error_count++;
}
+ // free memory
+ $this->smarty->template_objects = array();
+ $_tpl->smarty->template_objects = array();
+ $_tpl = null;
if ($max_errors !== null && $_error_count == $max_errors) {
echo '
too many errors';
exit();