This is actually not a memory leak, but rather static function caches that aren't being cleaned!
This is due to SimplePie_IRI::set_iri
(and set_authority
, and set_path
). They set a static $cache
variable, but they don't unset or clean this when a new instance of SimplePie
is created, which means the variables only gets bigger and bigger.
This can be fixed by changing
public function set_authority($authority)
{
static $cache;
if (!$cache)
$cache = array();
/* etc */
to
public function set_authority($authority, $clear_cache = false)
{
static $cache;
if ($clear_cache) {
$cache = null;
return;
}
if (!$cache)
$cache = array();
/* etc */
..etc in the following functions:
set_iri
,set_authority
,set_path
,
And adding a destructor to SimplePie_IRI
calling all the functions using a static cache, with a parameter of true
in $clear_cache, will work:
/**
* Clean up
*/
public function __destruct() {
$this->set_iri(null, true);
$this->set_path(null, true);
$this->set_authority(null, true);
}
Which will now result in no gain in memory consumption over time: