memory pool management with conference bridge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

In order to understand the way memory is managed by pjsip, i just implement
a small test that
creates several times a conference bridge, adds two ports, (a wav player and
wav recorder) connects both ports for
a while and afterwards destroy them all:

<code>
        _pool = pj_pool_create(_factory, "test",,,);

    for (i=0; i<MAX_LOOPS; i++)
    {
        PRINT_LOOP(i);

        pjmedia_conf_create(_pool,,,,_conf);
        pjmedia_wav_player_port_create(_pool,,,,_port_player);
        pjmedia_wav_writer_port_create(_pool,,,,_port_writer);

        pjmedia_conf_add_port(_conf,_port_player);
        pjmedia_conf_add_port(_conf,_port_writer);
        pjmedia_conf_connect_port(_conf,_port_player,_port_player);

        pj_thread_sleep(SLEEP_TIME);

        print_pool_usage(_pool);

        pjmedia_conf_destroy(_conf);
        pjmedia_port_destroy(_port_player);
        pjmedia_port_destroy(_port_writer);

        print_pool_usage(_pool);

    }

   </code>

i would expect the memory usage after destroying the conference and ports
will be release, but this is the print out of the
memory pool usage in after each loop:

   <log>

 ...
 16:10:12.100 confsample_mem  Loop 15
 16:10:14.120 confsample_mem  Total pool memory allocated=1349 KB, used=1241
KB
 16:10:15.796 confsample_mem  Total pool memory allocated=1344 KB, used=1237
KB
 16:10:15.799 confsample_mem  Loop 16
 16:10:17.824 confsample_mem  Total pool memory allocated=1409 KB, used=1297
KB
 16:10:19.300 confsample_mem  Total pool memory allocated=1404 KB, used=1292
KB
 16:10:19.300 confsample_mem  Loop 17
 16:10:21.328 confsample_mem  Total pool memory allocated=1469 KB, used=1352
KB
 16:10:22.791 confsample_mem  Total pool memory allocated=1464 KB, used=1348
KB
 16:10:22.791 confsample_mem  Loop 18
 16:10:24.820 confsample_mem  Total pool memory allocated=1529 KB, used=1407
KB
 16:10:26.508 confsample_mem  Total pool memory allocated=1524 KB, used=1403
KB
 ...
   </log>


How i am suppose to handle the memory in an application that
creates/destroys several conference bridge during run time:
- Should i use temporal pools for each conference and release them when it
is done?
- Should i re-use the conference/ports so i created them once when starting
the application?
- Is there any way to effectively free up the memory beside those destroy
methods?

Maybe someone can give me a good hint regarding this memory management issue

Thanks,
Carlos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20100917/c4caed6d/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux