So, in python if no __new__ method is written than that object becomes singleton in some words, right?<div><br></div><div>recordroute<br><br><div class="gmail_quote">On Thu, Feb 14, 2013 at 2:09 PM, Saúl Ibarra Corretgé <span dir="ltr"><<a href="mailto:saul@ag-projects.com" target="_blank">saul@ag-projects.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Feb 14, 2013, at 10:13 AM, Record Route wrote:<br>
<br>
> Hi Saul,<br>
><br>
> I sent INVITE's and for each INVITE Sylk instantiates new application instance before of "return app()" line<br>
><br>
> I tracked as logging as below.<br>
><br>
> @run_in_twisted_thread<br>
> def handle_notification(self, notification):<br>
> handler = getattr(self, '_NH_%s' % <a href="http://notification.name" target="_blank">notification.name</a>, Null)<br>
> handler(notification)<br>
><br>
> def _NH_SIPSessionNewIncoming(self, notification):<br>
> session = notification.sender<br>
> try:<br>
> self.authorization_handler.authorize_source(session.peer_address.ip)<br>
> except UnauthorizedRequest:<br>
> session.reject(403)<br>
> return<br>
> try:<br>
> app = self.get_application(session._invitation.request_uri, notification.data.headers)<br>
> except ApplicationNotLoadedError:<br>
> session.reject(404)<br>
> else:<br>
> log.msg('sys.getrefcounts(app) %s' % sys.getrefcount(app))<br>
> app.incoming_session(session)<br>
><br>
<br>
</div>If you print the app object you get every time, you'll see that it's actually the same object. No new instances are created, __new__ will give you the one that was created in the first place. I also added a log line like yours and I always get 3 printed, so I don't think the leak comes from here.<br>
<br>
Thanks for trying to help out!<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Saúl Ibarra Corretgé<br>
AG Projects<br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>