[Openmrcp-users] RE : OpenMRCP memory allocation

SP GLE spglegle at yahoo.fr
Mon Feb 18 03:59:52 EST 2008


Hi,
I upgraded the code to rev 540 (including new apr toolkit) and i have 
the same isssues (running openmrcpclient on recognizer rassource with removed apr_terminate() and 
apr_pool_destroy() from main.c ):

 8,192 bytes in 1 blocks are still reachable in loss record 6 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x416AD36: apr_thread_create (thread.c:175)
    by 0x4017E24: apt_task_start (apt_task.c:102)
    by 0x4014749: rtsp_agent_connect (rtsp_client_connection.c:147)
    by 0x4012C02: rtsp_engine_process_session_create (rtsp_engine.c:499)
    by 0x4012DDA: rtsp_engine_msg_handler (rtsp_engine.c:578)
    by 0x401855D: apt_consumer_task_run (apt_consumer_task.c:118)
    by 0x4018063: apt_task_run (apt_task.c:188)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 7 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x401495D: rtsp_agent_connection_create (rtsp_client_connection.c:229)
    by 0x4014734: rtsp_agent_connect (rtsp_client_connection.c:142)
    by 0x4012C02: rtsp_engine_process_session_create (rtsp_engine.c:499)
    by 0x4012DDA: rtsp_engine_msg_handler (rtsp_engine.c:578)
    by 0x401855D: apt_consumer_task_run (apt_consumer_task.c:118)
    by 0x4018063: apt_task_run (apt_task.c:188)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 8 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x4012672: rtsp_session_create (rtsp_engine.c:306)
    by 0x4012568: rtsp_engine_session_create (rtsp_engine.c:238)
    by 0x4011863: mrcp_rtsp_session_create (mrcp_rtsp_client.c:145)
    by 0x41339EE: mrcp_client_do_signaling_channel_create (mrcp_client.c:91)
    by 0x4133B6B: mrcp_client_channel_add (mrcp_client.c:156)
    by 0x4134043: mrcp_client_context_msg_process (mrcp_client.c:321)
    by 0x41346BC: mrcp_client_msg_handler (mrcp_client.c:603)
    by 0x401855D: apt_consumer_task_run (apt_consumer_task.c:118)
    by 0x4018063: apt_task_run (apt_task.c:188)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 9 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x4134EC7: mrcp_client_session_create (mrcp_client_session.c:36)
    by 0x41350AD: mrcp_client_context_session_create (mrcp_client_context.c:63)
    by 0x804AE6D: demo_recognizer_basic_run (demo_recognizer_scenario.c:302)
    by 0x804B010: demo_recognizer_run (demo_recognizer_scenario.c:386)
    by 0x80497C6: main (main.c:174)


 8,192 bytes in 1 blocks are still reachable in loss record 10 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x804A9E7: demo_session_create (demo_recognizer_scenario.c:81)
    by 0x804AE62: demo_recognizer_basic_run (demo_recognizer_scenario.c:301)
    by 0x804B010: demo_recognizer_run (demo_recognizer_scenario.c:386)
    by 0x80497C6: main (main.c:174)


 8,192 bytes in 1 blocks are still reachable in loss record 11 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x416AD36: apr_thread_create (thread.c:175)
    by 0x4139392: media_timer_start (media_timer.c:119)
    by 0x413956B: media_processor_start (media_processor.c:101)
    by 0x4016BA4: mrcp_live_agent_open (mrcp_media_frame.c:147)
    by 0x4135715: mrcp_engine_open (mrcp_engine.c:73)
    by 0x4134A89: mrcp_client_on_start_in_progress (mrcp_client.c:735)
    by 0x4018074: apt_task_run (apt_task.c:52)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 12 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x416AD36: apr_thread_create (thread.c:175)
    by 0x4017E24: apt_task_start (apt_task.c:102)
    by 0x4018441: apt_consumer_task_start (apt_consumer_task.c:65)
    by 0x4012433: rtsp_client_engine_start (rtsp_engine.c:188)
    by 0x401207E: mrcp_rtsp_agent_open (mrcp_rtsp_client.c:475)
    by 0x4135715: mrcp_engine_open (mrcp_engine.c:73)
    by 0x4134A89: mrcp_client_on_start_in_progress (mrcp_client.c:735)
    by 0x4018074: apt_task_run (apt_task.c:52)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 13 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x40122F4: rtsp_engine_create (rtsp_engine.c:146)
    by 0x40123F7: rtsp_client_engine_start (rtsp_engine.c:181)
    by 0x401207E: mrcp_rtsp_agent_open (mrcp_rtsp_client.c:475)
    by 0x4135715: mrcp_engine_open (mrcp_engine.c:73)
    by 0x4134A89: mrcp_client_on_start_in_progress (mrcp_client.c:735)
    by 0x4018074: apt_task_run (apt_task.c:52)
    by 0x416AC9F: dummy_worker (thread.c:142)
    by 0x447EB98B: start_thread (in /lib/tls/libpthread-0.61.so)
    by 0x44747169: clone (in /lib/tls/libc-2.3.3.so)


 8,192 bytes in 1 blocks are still reachable in loss record 14 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x416AD36: apr_thread_create (thread.c:175)
    by 0x4017E24: apt_task_start (apt_task.c:102)
    by 0x4018441: apt_consumer_task_start (apt_consumer_task.c:65)
    by 0x4134D6E: mrcp_client_start (mrcp_client.c:833)
    by 0x400E180: openmrcp_client_start (openmrcp_client.c:165)
    by 0x804AFE6: demo_recognizer_run (demo_recognizer_scenario.c:377)
    by 0x80497C6: main (main.c:174)


 8,192 bytes in 1 blocks are still reachable in loss record 15 of 18
    at 0x40047D1: malloc (vg_replace_malloc.c:207)
    by 0x416380E: allocator_alloc (apr_pools.c:300)
    by 0x4162D16: apr_pool_create_ex (apr_pools.c:800)
    by 0x4134C6E: mrcp_client_start (mrcp_client.c:797)
    by 0x400E180: openmrcp_client_start (openmrcp_client.c:165)
    by 0x804AFE6: demo_recognizer_run (demo_recognizer_scenario.c:377)
    by 0x80497C6: main (main.c:174)

Regards.

--- SP GLE <spglegle at yahoo.fr> a écrit :

> Hi,
> I removed the mrcp_global_destroy() from the mrcp client I'm writing
> and did some valgrind analysis on it.
> 
> - Memory is allocated through allocator_alloc (apr_pools.c:300), each
> allocation seems to be 8,192 Bytes, which is quite large. Is there a
> way to reduce allocation size ?
> 
> I would like to use openMRCP inside a process using one object for each
> client. In my implementation (C++) there is one object for each MRCP
> connection to an MRCP server. Memory pool is common to all objects an
> mrcp_global_destroy() will never be called unless on process exit. 
> 
> I removed mrcp_global_destroy() from openmrcpclient main demo and
> traced memory using valgrind, below are some results. Is it memleaks ?
> Some looks like pool allocated at apr_pool initialisation but some are
> allocated by OpenMRCP at runtime and not freed.
> 
> Regards.
> ==00:00:01:41.051 28685== 104 bytes in 1 blocks are still reachable in
> loss record 5 of 19
> ==00:00:01:41.052 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.052 28685==    by 0x4163730: apr_allocator_create
> (apr_pools.c:91)
> ==00:00:01:41.052 28685==    by 0x41638B2: apr_pool_initialize
> (apr_pools.c:519)
> ==00:00:01:41.052 28685==    by 0x4164C7E: apr_initialize (start.c:55)
> ==00:00:01:41.052 28685==    by 0x41365DC: mrcp_global_init
> (mrcp_global.c:41)
> ==00:00:01:41.052 28685==    by 0x80497C9: main (main.c:156)
> ==00:00:01:41.053 28685== 
> ==00:00:01:41.053 28685== 
> ==00:00:01:41.053 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 6 of 19
> ==00:00:01:41.053 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.053 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.053 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.053 28685==    by 0x416BD36: apr_thread_create
> (thread.c:175)
> ==00:00:01:41.053 28685==    by 0x4135B2A: mrcp_task_start
> (mrcp_task.c:100)
> ==00:00:01:41.053 28685==    by 0x4013F2D: rtsp_agent_connect
> (rtsp_client_connection.c:146)
> ==00:00:01:41.053 28685==    by 0x40122CE:
> rtsp_engine_process_session_create (rtsp_engine.c:499)
> ==00:00:01:41.053 28685==    by 0x40124A3: rtsp_engine_msg_handler
> (rtsp_engine.c:578)
> ==00:00:01:41.053 28685==    by 0x4136255: mrcp_consumer_task_run
> (mrcp_consumer_task.c:120)
> ==00:00:01:41.053 28685==    by 0x4135D5F: mrcp_task_run
> (mrcp_task.c:186)
> ==00:00:01:41.053 28685==    by 0x416BC9F: dummy_worker (thread.c:142)
> ==00:00:01:41.053 28685==    by 0x447EB98B: start_thread (in
> /lib/tls/libpthread-0.61.so)
> ==00:00:01:41.053 28685==    by 0x44747169: clone (in
> /lib/tls/libc-2.3.3.so)
> ==00:00:01:41.054 28685== 
> ==00:00:01:41.054 28685== 
> ==00:00:01:41.054 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 7 of 19
> ==00:00:01:41.054 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.054 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.054 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.054 28685==    by 0x4014145: rtsp_agent_connection_create
> (rtsp_client_connection.c:228)
> ==00:00:01:41.054 28685==    by 0x4013F18: rtsp_agent_connect
> (rtsp_client_connection.c:141)
> ==00:00:01:41.054 28685==    by 0x40122CE:
> rtsp_engine_process_session_create (rtsp_engine.c:499)
> ==00:00:01:41.054 28685==    by 0x40124A3: rtsp_engine_msg_handler
> (rtsp_engine.c:578)
> ==00:00:01:41.054 28685==    by 0x4136255: mrcp_consumer_task_run
> (mrcp_consumer_task.c:120)
> ==00:00:01:41.054 28685==    by 0x4135D5F: mrcp_task_run
> (mrcp_task.c:186)
> ==00:00:01:41.054 28685==    by 0x416BC9F: dummy_worker (thread.c:142)
> ==00:00:01:41.055 28685==    by 0x447EB98B: start_thread (in
> /lib/tls/libpthread-0.61.so)
> ==00:00:01:41.055 28685==    by 0x44747169: clone (in
> /lib/tls/libc-2.3.3.so)
> ==00:00:01:41.055 28685== 
> ==00:00:01:41.055 28685== 
> ==00:00:01:41.055 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 8 of 19
> ==00:00:01:41.055 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.055 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.055 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.055 28685==    by 0x4011D3A: rtsp_session_create
> (rtsp_engine.c:306)
> ==00:00:01:41.055 28685==    by 0x4011C30: rtsp_engine_session_create
> (rtsp_engine.c:238)
> ==00:00:01:41.055 28685==    by 0x4010EF7: mrcp_rtsp_session_create
> (mrcp_rtsp_client.c:144)
> ==00:00:01:41.055 28685==    by 0x41335B2:
> mrcp_client_do_signaling_channel_create (mrcp_client.c:92)
> ==00:00:01:41.055 28685==    by 0x413372F: mrcp_client_channel_add
> (mrcp_client.c:157)
> ==00:00:01:41.055 28685==    by 0x4133C1C:
> mrcp_client_context_msg_process (mrcp_client.c:322)
> ==00:00:01:41.055 28685==    by 0x4134294: mrcp_client_msg_handler
> (mrcp_client.c:604)
> ==00:00:01:41.055 28685==    by 0x4136255: mrcp_consumer_task_run
> (mrcp_consumer_task.c:120)
> ==00:00:01:41.055 28685==    by 0x4135D5F: mrcp_task_run
> (mrcp_task.c:186)
> ==00:00:01:41.055 28685==    by 0x416BC9F: dummy_worker (thread.c:142)
> ==00:00:01:41.055 28685==    by 0x447EB98B: start_thread (in
> /lib/tls/libpthread-0.61.so)
> ==00:00:01:41.055 28685==    by 0x44747169: clone (in
> /lib/tls/libc-2.3.3.so)
> ==00:00:01:41.056 28685== 
> ==00:00:01:41.056 28685== 
> ==00:00:01:41.056 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 9 of 19
> ==00:00:01:41.056 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.056 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.056 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.056 28685==    by 0x4134AF3: mrcp_client_session_create
> (mrcp_client_session.c:36)
> ==00:00:01:41.056 28685==    by 0x4134CD5:
> mrcp_client_context_session_create (mrcp_client_context.c:63)
> ==00:00:01:41.056 28685==    by 0x804AF01: demo_recognizer_basic_run
> (demo_recognizer_scenario.c:302)
> ==00:00:01:41.056 28685==    by 0x804B0A8: demo_recognizer_run
> (demo_recognizer_scenario.c:386)
> ==00:00:01:41.056 28685==    by 0x804980C: main (main.c:170)
> ==00:00:01:41.056 28685== 
> ==00:00:01:41.056 28685== 
> ==00:00:01:41.056 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 10 of 19
> ==00:00:01:41.057 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.057 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.057 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.057 28685==    by 0x804AA5F: demo_session_create
> (demo_recognizer_scenario.c:81)
> ==00:00:01:41.057 28685==    by 0x804AEF6: demo_recognizer_basic_run
> (demo_recognizer_scenario.c:301)
> ==00:00:01:41.057 28685==    by 0x804B0A8: demo_recognizer_run
> (demo_recognizer_scenario.c:386)
> ==00:00:01:41.057 28685==    by 0x804980C: main (main.c:170)
> ==00:00:01:41.057 28685== 
> ==00:00:01:41.057 28685== 
> ==00:00:01:41.057 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 11 of 19
> ==00:00:01:41.057 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.057 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.057 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.057 28685==    by 0x416BD36: apr_thread_create
> (thread.c:175)
> ==00:00:01:41.057 28685==    by 0x413A0A6: media_timer_start
> (media_timer.c:119)
> ==00:00:01:41.057 28685==    by 0x413A27F: media_processor_start
> (media_processor.c:101)
> ==00:00:01:41.057 28685==    by 0x40164A4: mrcp_live_agent_open
> (mrcp_media_frame.c:147)
> ==00:00:01:41.057 28685==    by 0x4135341: mrcp_engine_open
> (mrcp_engine.c:74)
> ==00:00:01:41.057 28685==    by 0x413465E:
> mrcp_client_on_start_in_progress (mrcp_client.c:736)
> ==00:00:01:41.057 28685==    by 0x4135D70: mrcp_task_run
> (mrcp_task.c:51)
> ==00:00:01:41.057 28685==    by 0x416BC9F: dummy_worker (thread.c:142)
> ==00:00:01:41.058 28685==    by 0x447EB98B: start_thread (in
> /lib/tls/libpthread-0.61.so)
> ==00:00:01:41.058 28685==    by 0x44747169: clone (in
> /lib/tls/libc-2.3.3.so)
> ==00:00:01:41.058 28685== 
> ==00:00:01:41.058 28685== 
> ==00:00:01:41.058 28685== 8,192 bytes in 1 blocks are still reachable
> in loss record 12 of 19
> ==00:00:01:41.058 28685==    at 0x40047D1: malloc
> (vg_replace_malloc.c:207)
> ==00:00:01:41.058 28685==    by 0x416480E: allocator_alloc
> (apr_pools.c:300)
> ==00:00:01:41.059 28685==    by 0x4163D16: apr_pool_create_ex
> (apr_pools.c:800)
> ==00:00:01:41.059 28685==    by 0x416BD36: apr_thread_create
> (thread.c:175)
> ==00:00:01:41.059 28685==    by 0x4135B2A: mrcp_task_start
> (mrcp_task.c:100)
> ==00:00:01:41.059 28685==    by 0x4136135: mrcp_consumer_task_start
> (mrcp_consumer_task.c:68)
> 
=== message truncated ===



      ____________________________________________________________________________________________
Yahoo! Mail innove : interface hyper pratique, messenger intégré, couleurs - http://mail.yahoo.fr



More information about the Openmrcp-users mailing list