From 163c395b2cfc15caf83ab2d46e79246c3909affd Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 6 Jul 2006 14:28:45 +0000 Subject: Set the caching pool workspace size in pjsip-test to 2MB (configurable) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@589 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/test-pjsip/test.c | 17 ++++++++++++++++- pjsip/src/test-pjsip/test.h | 9 +++++++++ pjsip/src/test-pjsip/uri_test.c | 10 +++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/pjsip/src/test-pjsip/test.c b/pjsip/src/test-pjsip/test.c index 3ae58daa..2b353ad9 100644 --- a/pjsip/src/test-pjsip/test.c +++ b/pjsip/src/test-pjsip/test.c @@ -243,7 +243,8 @@ int test_main(void) pj_dump_config(); - pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 ); + pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, + PJSIP_TEST_MEM_SIZE ); rc = pjsip_endpt_create(&caching_pool.factory, "endpt", &endpt); if (rc != PJ_SUCCESS) { @@ -340,6 +341,20 @@ int test_main(void) on_return: flush_events(500); + + /* Dumping memory pool usage */ + { + pj_pool_t *p; + unsigned sz = 0; + p = caching_pool.used_list.next; + while (p != (pj_pool_t*)&caching_pool.used_list) { + sz += pj_pool_get_capacity(p); + p = p->next; + } + PJ_LOG(3,(THIS_FILE, "Caching pool total capacity=%u", + caching_pool.capacity + sz)); + } + pjsip_endpt_destroy(endpt); pj_caching_pool_destroy(&caching_pool); diff --git a/pjsip/src/test-pjsip/test.h b/pjsip/src/test-pjsip/test.h index 969b341a..b7b79c7d 100644 --- a/pjsip/src/test-pjsip/test.h +++ b/pjsip/src/test-pjsip/test.h @@ -26,6 +26,15 @@ extern pjsip_endpoint *endpt; #define TEST_UDP_PORT 15060 #define TEST_UDP_PORT_STR "15060" +/** + * Memory size to use in caching pool. + * Default: 2MB + */ +#ifndef PJSIP_TEST_MEM_SIZE +# define PJSIP_TEST_MEM_SIZE (2*1024*1024) +#endif + + #define INCLUDE_MESSAGING_GROUP 1 #define INCLUDE_TRANSPORT_GROUP 1 diff --git a/pjsip/src/test-pjsip/uri_test.c b/pjsip/src/test-pjsip/uri_test.c index d2e55f20..06e7e27d 100644 --- a/pjsip/src/test-pjsip/uri_test.c +++ b/pjsip/src/test-pjsip/uri_test.c @@ -810,16 +810,16 @@ static int simple_uri_test(void) pj_status_t status; PJ_LOG(3,(THIS_FILE, " simple test")); - pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE); for (i=0; i