id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blockedby,phpversion,appname,pending,exts,sapi,probability,blocking
95,Memory is not free()'d after xcache_get() data is unset,krogot,moo,"I've tested EA vs XCache performance on cache reads and got the following problem:

Code:
{{{
#!php
<?php
	function ea_read ($max) # void
	{
		global $DATA;

		for($i = 0;$i<10;$i++)
		{
			$key[$i] = 'some_key_'.$i;
			eaccelerator_put($key[$i], $DATA);
		}

		for($i = 0;$i<$max;$i++)
			$val = eaccelerator_get($key[$i%10]);
	}

	function xcache_read ($max) # void
	{
		global $DATA;

		for($i = 0;$i<10;$i++)
		{
			$key[$i] = 'some_key_'.$i;
			xcache_set($key[$i], $DATA);
		}

		for($i = 0;$i<$max;$i++)
		{
			$val = xcache_get($key[$i%10]);
		}
	}
}}}
Result ($max = 10000):
{{{
#!php
<?php
    $DATA = str_repat('x',10000); 
}}}
Everything is ok.
{{{
#!php
<?php
    $DATA = array_map('uniqid', range(1,10));
}}}
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 15 bytes).

It seems that XCache somehow marks array items that they aren't released (may be it increases ref_count?). I tried to add ""unset($val);"" after ""$val = xcache_get();"" but it didn't help.

The only solution I've found is:
{{{
#!php
<?php
   xcache_set($key,serialize($data));
   $val = unserialize(xcache_get($key));
}}}
but it looks weird (and slows down xcache calls) ...",defect,assigned,major,3.1.0,cacher,1.2.2,,,mat999@…,,5.3.2,,0,,Irrelevant,Always,
