Hi
 
Our application makes use of long-running calls with a lot of diaplan transfers to bridge them to other calls, put them on hold etc.  We've noticed a slow down in performance (high CPU, audio dropped, delayed) after several hours.  I can reproduce it with some dialplan that does 1000 transfers: 

<extension name="test_transfer">
  <condition field="destination_number" expression="^test_transfer$">
    <action application="set" data="max_forwards=9999"/>
    <action application="transfer" data="test_transfer_999"/>
  </condition>
</extension>
<extension name="test_transfer_0" continue="false">
  <condition field="destination_number" expression="^test_transfer_0$">
    <action application="hangup"/>
  </condition>
</extension>
<extension name="test_transfer_n">
  <condition field="destination_number" expression="^test_transfer_(\d+)$">
    <!--<action application="info"/>-->
    <action application="transfer" data="test_transfer_${expr $1-1}"/>
  </condition>
</extension>
and then
 
originate user/1000 test_transfer XML blah
 
On a Windows laptop (git head) it slows down to more than 1 sec per iteration after it gets past 800, on a bigger Linux server (FS 1.2.5.1) it gets a bit futher but not much.  On a server with an old version (git-1086cba 2011-05-23 22-51-43 -0500) it zips through to the end with no slow down.  If you put the info call in you can see that variable_transfer_history is growing, and I think this is the source of the problem - this variable is missing from the older version but the newer ones are apparently appending to it on each iteration which becomes a very expensive operation.
 
I'll raise a Jira.  Any suggestion for a workaround? (Apart from rewriting our dialplan!)
 
David