Hi Saul,<div><br></div><div>I sent INVITE's and for each INVITE Sylk instantiates new application instance before of "return app()" line</div><div><br><div>I tracked as logging as below.</div><div><br></div><div>
<div> @run_in_twisted_thread</div><div> def handle_notification(self, notification):</div><div> handler = getattr(self, '_NH_%s' % <a href="http://notification.name">notification.name</a>, Null)</div>
<div> handler(notification)</div><div><br></div><div> def _NH_SIPSessionNewIncoming(self, notification):</div><div> session = notification.sender</div><div> try:</div><div> self.authorization_handler.authorize_source(session.peer_address.ip)</div>
<div> except UnauthorizedRequest:</div><div> session.reject(403)</div><div> return</div><div> try:</div><div> app = self.get_application(session._invitation.request_uri, notification.data.headers)</div>
<div> except ApplicationNotLoadedError:</div><div> session.reject(404)</div><div> else:</div><div> log.msg('sys.getrefcounts(app) %s' % sys.getrefcount(app))</div><div> app.incoming_session(session)</div>
<br><div class="gmail_quote">On Thu, Feb 14, 2013 at 10:57 AM, 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 8:09 AM, Record Route wrote:<br>
<br>
> Each time a request received by Sylk, get application method called by the __init__.py under sylk/applcation folder, and it instantiates application instance time<br>
><br>
> def get_application(self, ruri, headers):<br>
> if SYLK_APP_HEADER in headers:<br>
> application = headers[SYLK_APP_HEADER].body.strip()<br>
> else:<br>
> application = ServerConfig.default_application<br>
> if self.application_map:<br>
> prefixes = ("%s@%s" % (ruri.user, ruri.host), ruri.host, ruri.user)<br>
> for prefix in prefixes:<br>
> if prefix in self.application_map:<br>
> application = self.application_map[prefix]<br>
> break<br>
> try:<br>
> app = (app for app in ApplicationRegistry() if app.__appname__ == application).next()<br>
> except StopIteration:<br>
> log.error('Application %s is not loaded' % application)<br>
> raise ApplicationNotLoadedError<br>
> else:<br>
> return app() # This is the line I'm trying to mention.<br>
><br>
<br>
</div>Those are the application objects, which are indeed singletons, so memory won't grow after startup because they are instantiated only once throughout the lifetime of the process.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
Saúl Ibarra Corretgé<br>
AG Projects<br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div></div>