[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "safe_construct_w_pool" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Aug 15 14:29:58 CDT 2012


branch "safe_construct_w_pool" has been updated
       via  42310a3a78e9b4eb3372c48ebb36c2698b40b906 (commit)
      from  d070d485e3030bcd5e4c1a6820e44ea0223cd754 (commit)

Summary of changes:
 src/SIPClientRegistration.cpp |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)


- Log -----------------------------------------------------------------
commit 42310a3a78e9b4eb3372c48ebb36c2698b40b906
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Aug 8 17:13:13 2012 -0230

    FINALLY uncovered a huge source of memory consumption. Once things got to a
    certain point in the call setup sequence a lot of timers started to be created.
    Once 500 living calls (1000 session objects) memory would fly through the roof.

diff --git a/src/SIPClientRegistration.cpp b/src/SIPClientRegistration.cpp
index bb5f4e1..aa6dc4d 100644
--- a/src/SIPClientRegistration.cpp
+++ b/src/SIPClientRegistration.cpp
@@ -129,6 +129,31 @@ private:
 
 using namespace AsteriskSCF::SIP::ExtensionPoint::V1;
 
+//
+// Singleton for now, but could be pool.
+//
+class TimerPool
+{
+public:
+
+    static IceUtil::TimerPtr getTimer()
+    {
+        IceUtil::Mutex::Lock lock(mMutex);
+        if (!mTimer)
+        {
+            mTimer = new IceUtil::Timer;
+        }
+        return mTimer;
+    }
+
+private:
+    static IceUtil::Mutex mMutex;
+    static IceUtil::TimerPtr mTimer;
+};
+
+IceUtil::Mutex TimerPool::mMutex;
+IceUtil::TimerPtr TimerPool::mTimer;
+
 SIPRegistrationClient::SIPRegistrationClient(
         const SIPClientRegistrationItemPtr& confItem,
         pjsip_endpoint* pjEndpoint,
@@ -140,7 +165,7 @@ SIPRegistrationClient::SIPRegistrationClient(
     : mEndpointName(sipEndpoint->getName()),
     mAOR(confItem->aor),
     mManager(manager),
-    mTimer(new IceUtil::Timer()),
+    mTimer(TimerPool::getTimer()),
     mReplicationContext(replicationContext),
     mBackplaneAdapter(backplaneAdapter),
     mReplica(replica)

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list