why start_thread consumes so much memory ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

why start_thread consumes so much memory ?

chichi
Hi All,

I am trying to locate which part of our application that causes a memory spike. Considering that our application is composed of about two hundred elements which are scattered over 70 threads, I use Massif, one of Valgrind tools to check heap memory profile during the execution of our application. I list the detailed information of snapshot 48 of Massif output. As you can see that starting "this" thread consumes most of the memory. Also I found that this thread is not such thread that is created by "queue" element, because I can see that "queue" thread are created after the memory spike. It seems like it is a main thread that handles preliminary things. Can anyone give me some explanation about it. Any help is appreciated.

Thanks!

    GB
1.079^                                                                       #
     |                                                                 :@:::@#
     |                                                       :@:::::@:::@:::@#
     |                                            ::::::::::::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     |                                      :::::::::::: :: ::@:::::@:::@:::@#
     | ::@:::::::::::::::::::::@@@@::::::::::::::::::::: :: ::@:::::@:::@:::@#
   0 +----------------------------------------------------------------------->Gi
     0                                                                   619.3

Number of snapshots: 52
 Detailed snapshots: [3, 9, 32, 38, 43, 47, 48 (peak), 51]

   
--------------------------------------------------------------------------------
  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
--------------------------------------------------------------------------------
 48 661,339,638,719    1,158,568,168    1,153,638,753     4,929,415            0

 99.57% (1,153,638,753B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->71.34% (826,503,872B) 0x3054430468: gst_buffer_try_new_and_alloc (in /usr/lib64/libgstreamer-0.10.so.0.29.0)
| ->71.34% (826,503,872B) 0x30544593E4: ??? (in /usr/lib64/libgstreamer-0.10.so.0.29.0)
|   ->67.01% (776,396,992B) 0x3054C2E34A: ??? (in /usr/lib64/libgstbase-0.10.so.0.29.0)
|   | ->67.01% (776,396,992B) 0x3054C2EA6A: ??? (in /usr/lib64/libgstbase-0.10.so.0.29.0)
|   |   ->67.01% (776,396,992B) 0x305445DEC8: gst_pad_push (in /usr/lib64/libgstreamer-0.10.so.0.29.0)
|   |   | ->67.01% (776,396,800B) 0x2851A728: ??? (in /usr/lib64/gstreamer-0.10/libgstcoreelements.so)
|   |   | | ->67.01% (776,396,800B) 0x3054484362: ??? (in /usr/lib64/libgstreamer-0.10.so.0.29.0)
|   |   | |   ->67.01% (776,396,800B) 0x303526C746: ??? (in /lib64/libglib-2.0.so.0.3000.2)
|   |   | |     ->67.01% (776,396,800B) 0x303526A224: ??? (in /lib64/libglib-2.0.so.0.3000.2)
|   |   | |       ->67.01% (776,396,800B) 0x3033607D8E: start_thread (in /lib64/libpthread-2.14.90.so)
|   |   | |        
|   |   | ->00.00% (192B) in 1+ places, all below ms_print's threshold (01.00%)
|   |   |
|   |   ->00.00% (0B) in 1+ places, all below ms_print's threshold (01.00%)
|   |  

--
Qi Chu, Ph.D student
Australian International Gravitational Research Centre
School of physics
The University of Western Australia
M013, 35 Stirling Hwy
Crawley, WA 6009
Australia
Email: [hidden email]



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: why start_thread consumes so much memory ?

Nicolas Dufresne
To answer the question in the subject, start_thread() is the base function for all your 70 threads. So the result from start_thread() being the main source of allocation is quite expected. It only means that most allocation are being done in threads.

Now, to get more useful result from your profiling, I would recommend you to run it on a Gstreamer build that has debugging symbols. This will replace the "??? (in /usr/lib64/libgstreamer-0.10.so.0.29.0)" in your backtraces with specific functions.

best regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: why start_thread consumes so much memory ?

chichi
Hi Nicolas,

Not sure why I missed your email until today. Thank you very much ! I will try that.

Cheers!
Qi

On Wed, Sep 26, 2012 at 9:50 PM, Nicolas Dufresne <[hidden email]> wrote:
To answer the question in the subject, start_thread() is the base function for all your 70 threads. So the result from start_thread() being the main source of allocation is quite expected. It only means that most allocation are being done in threads.

Now, to get more useful result from your profiling, I would recommend you to run it on a Gstreamer build that has debugging symbols. This will replace the "??? (in /usr/lib64/libgstreamer-0.10.so.0.29.0)" in your backtraces with specific functions.

best regards,
Nicolas

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Qi Chu, Ph.D student
Australian International Gravitational Research Centre
School of physics
The University of Western Australia
M013, 35 Stirling Hwy
Crawley, WA 6009
Australia
Email: [hidden email]



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel