Index: pjproject/trunk/pjmedia/include/pjmedia/event.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/event.h	(revision 3904)
+++ pjproject/trunk/pjmedia/include/pjmedia/event.h	(revision 3905)
@@ -332,5 +332,4 @@
  *
  * @param mgr		The event manager.
- * @param pool          Pool to allocate memory from.
  * @param cb            The callback function to receive the event.
  * @param user_data     The user data to be associated with the callback
@@ -341,5 +340,4 @@
  */
 PJ_DECL(pj_status_t) pjmedia_event_subscribe(pjmedia_event_mgr *mgr,
-                                             pj_pool_t *pool,
                                              pjmedia_event_cb *cb,
                                              void *user_data,
Index: pjproject/trunk/pjmedia/src/pjmedia/event.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/event.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/pjmedia/event.c	(revision 3905)
@@ -50,4 +50,5 @@
 struct pjmedia_event_mgr
 {
+    pj_pool_t      *pool;
     pj_thread_t    *thread;             /**< worker thread.             */
     pj_bool_t       is_quitting;
@@ -57,4 +58,5 @@
     event_queue    *pub_ev_queue;       /**< publish() event queue.     */
     esub            esub_list;          /**< list of subscribers.       */
+    esub            free_esub_list;     /**< list of subscribers.       */
     esub           *th_next_sub,        /**< worker thread's next sub.  */
                    *pub_next_sub;       /**< publish() next sub.        */
@@ -155,12 +157,16 @@
 
     mgr = PJ_POOL_ZALLOC_T(pool, pjmedia_event_mgr);
+    mgr->pool = pj_pool_create(pool->factory, "evt mgr", 500, 500, NULL);
     pj_list_init(&mgr->esub_list);
+    pj_list_init(&mgr->free_esub_list);
 
     if (!(options & PJMEDIA_EVENT_MGR_NO_THREAD)) {
-        status = pj_sem_create(pool, "ev_sem", 0, MAX_EVENTS + 1, &mgr->sem);
+        status = pj_sem_create(mgr->pool, "ev_sem", 0, MAX_EVENTS + 1,
+                               &mgr->sem);
         if (status != PJ_SUCCESS)
             return status;
 
-        status = pj_thread_create(pool, "ev_thread", &event_worker_thread,
+        status = pj_thread_create(mgr->pool, "ev_thread",
+                                  &event_worker_thread,
                                   mgr, 0, 0, &mgr->thread);
         if (status != PJ_SUCCESS) {
@@ -170,5 +176,5 @@
     }
 
-    status = pj_mutex_create_recursive(pool, "ev_mutex", &mgr->mutex);
+    status = pj_mutex_create_recursive(mgr->pool, "ev_mutex", &mgr->mutex);
     if (status != PJ_SUCCESS) {
         pjmedia_event_mgr_destroy(mgr);
@@ -197,6 +203,4 @@
 PJ_DEF(void) pjmedia_event_mgr_destroy(pjmedia_event_mgr *mgr)
 {
-    esub *sub;
-
     if (!mgr) mgr = pjmedia_event_mgr_instance();
     PJ_ASSERT_ON_FAIL(mgr != NULL, return);
@@ -218,10 +222,6 @@
     }
 
-    sub = mgr->esub_list.next;
-    while (sub != &mgr->esub_list) {
-	esub *next = sub->next;
-	pj_list_erase(sub);
-	sub = next;
-    }
+    if (mgr->pool)
+        pj_pool_release(mgr->pool);
 
     if (event_manager_instance == mgr)
@@ -242,5 +242,4 @@
 
 PJ_DEF(pj_status_t) pjmedia_event_subscribe( pjmedia_event_mgr *mgr,
-                                             pj_pool_t *pool,
                                              pjmedia_event_cb *cb,
                                              void *user_data,
@@ -249,5 +248,5 @@
     esub *sub;
 
-    PJ_ASSERT_RETURN(pool && cb, PJ_EINVAL);
+    PJ_ASSERT_RETURN(cb, PJ_EINVAL);
 
     if (!mgr) mgr = pjmedia_event_mgr_instance();
@@ -271,5 +270,9 @@
     }
 
-    sub = PJ_POOL_ZALLOC_T(pool, esub);
+    if (mgr->free_esub_list.next != &mgr->free_esub_list) {
+        sub = mgr->free_esub_list.next;
+        pj_list_erase(sub);
+    } else
+        sub = PJ_POOL_ZALLOC_T(mgr->pool, esub);
     sub->cb = cb;
     sub->user_data = user_data;
@@ -310,4 +313,5 @@
                 mgr->pub_next_sub = sub->next;
             pj_list_erase(sub);
+            pj_list_push_back(&mgr->free_esub_list, sub);
             if (user_data && epub)
                 break;
Index: pjproject/trunk/pjmedia/src/pjmedia/vid_port.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/vid_port.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/pjmedia/vid_port.c	(revision 3905)
@@ -268,5 +268,5 @@
 
     /* Subscribe to device's events */
-    pjmedia_event_subscribe(NULL, vp->pool, &vidstream_event_cb,
+    pjmedia_event_subscribe(NULL, &vidstream_event_cb,
                             vp, vp->strm);
 
@@ -411,5 +411,5 @@
 
     /* Subscribe to client port's events */
-    pjmedia_event_subscribe(NULL, vp->pool, &client_port_event_cb, vp,
+    pjmedia_event_subscribe(NULL, &client_port_event_cb, vp,
                             vp->client_port);
 
Index: pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 3905)
@@ -1362,5 +1362,5 @@
 
     /* Subscribe to codec events */
-    pjmedia_event_subscribe(NULL, pool, &stream_event_cb, stream,
+    pjmedia_event_subscribe(NULL, &stream_event_cb, stream,
                             stream->codec);
 
Index: pjproject/trunk/pjmedia/src/test/vid_codec_test.c
===================================================================
--- pjproject/trunk/pjmedia/src/test/vid_codec_test.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/test/vid_codec_test.c	(revision 3905)
@@ -321,5 +321,5 @@
 
 	/* Subscribe to codec events */
-	pjmedia_event_subscribe(NULL, pool, &codec_on_event, &codec_port_data,
+	pjmedia_event_subscribe(NULL, &codec_on_event, &codec_port_data,
                                 codec);
     }
Index: pjproject/trunk/pjmedia/src/test/vid_dev_test.c
===================================================================
--- pjproject/trunk/pjmedia/src/test/vid_dev_test.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/test/vid_dev_test.c	(revision 3905)
@@ -161,5 +161,5 @@
 
     /* Set event handler */
-    pjmedia_event_subscribe(NULL, pool, &vid_event_cb, NULL, renderer);
+    pjmedia_event_subscribe(NULL, &vid_event_cb, NULL, renderer);
 
     /* Connect capture to renderer */
Index: pjproject/trunk/pjmedia/src/test/vid_port_test.c
===================================================================
--- pjproject/trunk/pjmedia/src/test/vid_port_test.c	(revision 3904)
+++ pjproject/trunk/pjmedia/src/test/vid_port_test.c	(revision 3905)
@@ -118,5 +118,5 @@
 
     /* Set event handler */
-    pjmedia_event_subscribe(NULL, pool, &vid_event_cb, NULL, renderer);
+    pjmedia_event_subscribe(NULL, &vid_event_cb, NULL, renderer);
 
     /* Connect capture to renderer */
Index: pjproject/trunk/pjsip-apps/src/samples/aviplay.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/samples/aviplay.c	(revision 3904)
+++ pjproject/trunk/pjsip-apps/src/samples/aviplay.c	(revision 3905)
@@ -402,5 +402,5 @@
 
         /* subscribe events */
-        pjmedia_event_subscribe(NULL, pool, &avi_event_cb, &avi_port,
+        pjmedia_event_subscribe(NULL, &avi_event_cb, &avi_port,
                                 renderer);
 
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c	(revision 3904)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c	(revision 3905)
@@ -830,5 +830,5 @@
 #if ENABLE_EVENT
 	    /* Register to video events */
-	    pjmedia_event_subscribe(NULL, w->pool, &call_media_on_event,
+	    pjmedia_event_subscribe(NULL, &call_media_on_event,
                                     call_med, w->vp_rend);
 #endif
@@ -900,5 +900,5 @@
 	    w = &pjsua_var.win[wid];
 #if ENABLE_EVENT
-            pjmedia_event_subscribe(NULL, w->pool, &call_media_on_event,
+            pjmedia_event_subscribe(NULL, &call_media_on_event,
                                     call_med, w->vp_cap);
 #endif
@@ -1909,5 +1909,5 @@
 
 #if ENABLE_EVENT
-    pjmedia_event_subscribe(NULL, new_w->pool, &call_media_on_event,
+    pjmedia_event_subscribe(NULL, &call_media_on_event,
                             call_med, new_w->vp_cap);
 #endif
@@ -1951,5 +1951,5 @@
 #if ENABLE_EVENT
     /* Resubscribe */
-    pjmedia_event_subscribe(NULL, w->pool, &call_media_on_event,
+    pjmedia_event_subscribe(NULL, &call_media_on_event,
                             call_med, w->vp_cap);
 #endif
