<div dir="ltr">Pretty please! Negative answer is better than no answer at all.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 17, 2015 at 10:07 PM, Michael Kilburn <span dir="ltr"><<a href="mailto:crusader.mike@gmail.com" target="_blank">crusader.mike@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><span class=""><div><br></div><span style="color:rgb(80,0,80)">On Mon, 2015-01-12 at 23:48 -0600, Michael Kilburn wrote:<br></span><span style="color:rgb(80,0,80)">> Is there any easy way in omniOrbPy to automatically switch gc off in<br>> every outgoing call? (and then switch it back once all data is<br>> received and converted to python objects)</span><div><font color="#500050"><br></font></div></span><div><font color="#500050"><br></font><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Jan 20, 2015 at 6:05 PM, Michael Kilburn <span dir="ltr"><<a href="mailto:crusader.mike@gmail.com" target="_blank">crusader.mike@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Here is the solution I came up with:<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>import _omnipy</div><div>_omnipy_invoke = _omnipy.invoke</div><div> </div><div>def invoke_mk2(*args):</div><div> import gc</div><div> gc_flag = gc.isenabled()</div><div> try:</div><div> if gc_flag: gc.disable()</div><div> return _omnipy_invoke(*args)</div><div> finally:</div><div> if gc_flag: gc.enable()</div><div> </div><div>_omnipy.invoke = invoke_mk2</div></blockquote></div></blockquote><div><br></div></span><div>As you see I solved the problem by intercepting and wrapping _omnipy.invoke(). Unfortunately in Omni4.x we have:<br></div><div><br></div>class _objref_MyInterface(CORBA.Object):<br> _NP_RepositoryId = MyInterface._NP_RepositoryId<br> <br> def __init__(self, obj):<br> CORBA.Object.__init__(self, obj)<br> <br> def myMethod(self, *args):<br> return self._obj.invoke("myMethod", ..., args)<br><br>i.e. there is no single method to intercept for an easy fix. Or better to say, I did not find it yet.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Can anyone advise a good way to achieve this?<br></div><div class="gmail_quote"><span class=""><br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Apparently problem this snippet solves was addressed in Python 2.7. Though, I would imagine switching off GC completely is still better than reducing number of collections.</div></blockquote><div><br></div></span><div>Switching off GC gives a nice performance boost even with Python 2.7 (in my tests)</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div>Sincerely yours,<br>Michael.</div>
</font></span></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Sincerely yours,<br>Michael.</div>
</div>