diff options
author | Ermal <eri@pfsense.org> | 2013-12-16 13:57:11 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-12-16 13:57:11 +0000 |
commit | 00e550886c109f4981d01b093aeaebfff68f7914 (patch) | |
tree | 323d68a3393a80f5868fe892b932b1b5d3546bfd /etc/inc/config.lib.inc | |
parent | 5be2085a972351e0066c2810485c7e95eaf4e975 (diff) | |
download | pfsense-00e550886c109f4981d01b093aeaebfff68f7914.zip pfsense-00e550886c109f4981d01b093aeaebfff68f7914.tar.gz |
Register a function to unset certain globals after requests finish processing to release memory early
Diffstat (limited to 'etc/inc/config.lib.inc')
-rw-r--r-- | etc/inc/config.lib.inc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index 0588252..8d80e98 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -909,4 +909,28 @@ function make_config_revision_entry($desc = null, $override_user = null) { return $revision; } +function pfSense_clear_globals() { + global $config, $FilterIfList, $GatewaysList, $filterdns, $aliases, $aliastable; + + if (isset($FilterIfList)) + unset($FilterIfList); + + if (isset($GatewaysList)) + unset($GatewaysList); + + /* Used for the hostname dns resolver */ + if (isset($filterdns)) + unset($filterdns); + + /* Used for aliases and interface macros */ + if (isset($aliases)) + unset($aliases); + if (isset($aliastable)) + unset($aliastable); + + unset($config); +} + +register_shutdown_function('pfSense_clear_globals'); + ?> |