Fix Memory Leaks in C Code with Valgrind

Поделиться
HTML-код
  • Опубликовано: 3 июл 2022
  • In this video, we learn how to discover and fix memory leaks in C, using Valgrind.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine.com/books/
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/
  • НаукаНаука

Комментарии • 19

  • @killermonkey1392
    @killermonkey1392 2 года назад +33

    Valgrind becomes especially powerful when you're compiling with debug symbols (-g), since it then also shows you the file and line number where the leak, invalid write etc. occurs (as can be seen for some STL functions in the video).

  • @markusbuchholz3518
    @markusbuchholz3518 2 года назад +4

    I do believe your channel is outstanding with remarkable and consistent content . You are brilliant person who share the knowledge and inspire people to be better in probably most challenging domain in our times. I love especially parts where you discuss great Linux, C++ , compilers, and other content connected with fundamental principles of Computer Science. Keep finger for you success and goals!

  • @lennuard_6998
    @lennuard_6998 2 года назад

    please more c content!
    love ur videos

  • @ripplerxeon
    @ripplerxeon 2 года назад

    Thanks for the video ... It helps allot

  • @ralvarezb78
    @ralvarezb78 2 года назад

    So useful to find memory leaks when you make glue code between python and C

  • @JLSXMK8
    @JLSXMK8 2 года назад +1

    "[numOfAllocs] allocations, [numOfFrees] frees"; The program gives you a summary of the number of memory allocations and deallocations by providing an overall count, possibly before providing you with more information on each specific memory leak. This is just in case you have dozens of memory leaks to fix and you need to run it multiple times in order to make sure each one is taken care of.

  • @adegbiteseyi1342
    @adegbiteseyi1342 10 месяцев назад

    this is a great insight into interpreting the checks. but i will like you to explain to deal with the errors that occur as a result of the invalid write of size 4..... thanks

  • @azoicxx
    @azoicxx 2 года назад +1

    Hey, I watch lots of your videos, and I see you are a beast with python and other languages, and I since im working on this project, I decided to ask you this. Can you show how to make a steam account generator please? I'm trying to do it in python using selenium and the online temp-mail generator but it's a bit hard to set up proxies,solve the captchas and I don't really know how to confirm the email. Thank you!!

  • @guilherme5094
    @guilherme5094 2 года назад

    👍Thanks!

  • @philtoa334
    @philtoa334 2 года назад

    Thx_.

  • @shadowrealm8937
    @shadowrealm8937 2 месяца назад

    shouldnt it be malloc(sizeof(char)*20))?

    • @mrglick5050
      @mrglick5050 14 дней назад

      sizeof(char) is equal to 1, i would still do it for clarity though

  • @tips1483
    @tips1483 2 года назад

    Hello!

  • @paulfloyd9258
    @paulfloyd9258 7 месяцев назад

    --track-origins doesn't help with leak detection
    As valgrind --help says
    --track-origins=no|yes show origins of undefined values? [no]
    You can also track file descriptors
    --track-fds=no|yes|all track open file descriptors? [no]
    (which will be the int file descriptor underlying the FILE interface)

  • @judedavis92
    @judedavis92 2 года назад +1

    I liked the video and this was helpful. One thing though is that sometimes when you talk you sound like you're bored like at 6:10. Sometimes my teachers speak like that and for some reason, it irritates me. Even TWT sometimes speaks like that and I'm not sure why it's so common :D. Just a small point, but I still really like your videos in general.

    • @navi-wi9mu
      @navi-wi9mu 4 месяца назад

      Because we are all dead inside.. haha

  • @chriswang8343
    @chriswang8343 Год назад +1

    where did u even get valgrind? do u need to install it? Is it an extention?

    • @CoolKoon
      @CoolKoon Год назад

      Watch the video again. It says right there.

  • @SerjCrimea
    @SerjCrimea 8 месяцев назад

    Hi from Crimea? Russia. Am see your video with Yandex/Alisa AI/ Translate ;)