IronPython Memory Leak When Calling Function With More Than 13 Parameters -
i'm using ironpython 2.6.2 .net 4.0 scripting platform within c#/wpf application. scripts can include own function definitions, class definitions, etc. i'm not restricting can written.
a memory leak appeared in scripting piece after script change. after commenting out more , more code, determined defining , calling function more 13 parameters causes memory leak. if call function 14 parameters ironpython leak.
here sample code on timer running every 100ms:
_timer.enabled = false; try { var engine = python.createengine(); engine.execute("def somefunc(parami, paramii, paramiii, paramiv, paramv, paramvi, paramvii, paramviii, paramix, paramx, paramxi, paramxii, paramxiii, paramxiv):\r\n\tpass\r\nsomefunc(1,2,3,4,5,6,7,8,9,10,11,12,13,14)"); //engine.execute("def somefunc(parami, paramii, paramiii, paramiv, paramv, paramvi, paramvii, paramviii, paramix, paramx, paramxi, paramxii, paramxiii):\r\n\tpass\r\nsomefunc(1,2,3,4,5,6,7,8,9,10,11,12,13)"); // , without following line makes no difference engine.runtime.shutdown(); this.dispatcher.invoke((action)delegate() { this.title = datetime.now.tostring(); }); } catch (exception) { } _timer.enabled = true;
note have 14-parameter version of script , below commented-out 13-parameter version. python script this:
def somefunc(parami, paramii, paramiii, paramiv, paramv, paramvi, paramvii, paramviii, paramix, paramx, paramxi, paramxii, paramxiii, paramxiv): pass somefunc(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
i've tried , without engine.runtime.shutdown() makes no difference. 14-parameter version's memory climb rapidly , 13-parameter version's memory climb , stabilize.
any thoughts?
thanks - shaun
there's magic number of parameters in ironpython - less different (faster) code path more. sounds there still bugs in fallback code. can please open issue self-contained test case?
looking @ latest code think boundary @ 15. can try again on 2.7 beta 2 , see if results same?
Comments
Post a Comment