본문 바로가기

gstreamer

Gstreamer Memory monit with valgrind

https://snapcraft.io/install/valgrind/centos

 

Install valgrind on CentOS using the Snap Store | Snapcraft

Get the latest version of valgrind for on CentOS - A programming tool for memory debugging, leak detection, and profiling

snapcraft.io

1. valgrin 설치 방법

 

 

2 . gstreamer 를 사용할 때, supp 를 넣어줘야 오탐을 방지할 수 있다. 외부라이브러리 라서 glib으로 잡을경우 대량의 오탐이 발생한다.! 

다음 링크는 ubuntu 에서 valgrind로 gstreamer 변화를 관찰하는데 유용하다. 

supp include 전

==899664== LEAK SUMMARY:
==899664==    definitely lost: 16,632 bytes in 8 blocks
==899664==    indirectly lost: 0 bytes in 0 blocks
==899664==      possibly lost: 8,428 bytes in 72 blocks
==899664==    still reachable: 2,883,316 bytes in 25,856 blocks
==899664==                       of which reachable via heuristic:
==899664==                         length64           : 2,128 bytes in 46 blocks
==899664==                         newarray           : 1,840 bytes in 35 blocks
==899664==         suppressed: 0 bytes in 0 blocks
==899664==
==899664== For lists of detected and suppressed errors, rerun with: -s
==899664== ERROR SUMMARY: 79 errors from 79 contexts (suppressed: 0 from 0)

 

supp include 후

LEAK SUMMARY:
==899730==    definitely lost: 12 bytes in 1 blocks
==899730==    indirectly lost: 0 bytes in 0 blocks
==899730==      possibly lost: 0 bytes in 0 blocks
==899730==    still reachable: 564,861 bytes in 1,756 blocks
==899730==                       of which reachable via heuristic:
==899730==                         length64           : 2,128 bytes in 46 blocks
==899730==                         newarray           : 1,840 bytes in 35 blocks
==899730==         suppressed: 2,339,357 bytes in 24,178 blocks
==899730== Reachable blocks (those to which a pointer was found) are not shown.
==899730== To see them, rerun with: --leak-check=full --show-leak-kinds=all

 

따라서 아래와같이  run option 에 넣어주어야 한다.  

example 

run_with_val(){
G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind \
--leak-check=full --leak-resolution=high --num-callers=20 --trace-children=yes \
--suppressions=/home/yjlee/lib/supp/gst.supp \
--suppressions=/home/yjlee/lib/supp/glib.supp \
./${APP_NAME}  1>> console.log 2>&1 &
}

 

 

 

##### gperftools 를 활용하는게 더 좋았을 것이다. 

--그림으로 알려줌. 해당 앱사용해서 메모리 누수 보완함. 

'gstreamer' 카테고리의 다른 글

[명령어 정리] live stream 상태 체크 방법 (w. ffprobe 간단!)  (0) 2022.11.10
gstreamer : muxer  (0) 2022.11.10
gstreamer : muxer  (0) 2022.11.03
미디어 관련내용 정리  (0) 2022.11.03
[python] mp4 file streaming with gstreamer  (0) 2022.08.26