Fix Memory Leaks in C Code with Valgrind

preview_player
Показать описание
In this video, we learn how to discover and fix memory leaks in C, using Valgrind.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Рекомендации по теме
Комментарии
Автор

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).

killermonkey
Автор

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!

markusbuchholz
Автор

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 thanks

adegbiteseyi
Автор

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!!

azoicxx
Автор

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

ralvarezb
Автор

"[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.

JLSXMK
Автор

--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)

paulfloyd
Автор

please more c content!
love ur videos

lennuard_
Автор

Thanks for the video ... It helps allot

ripplerxeon
Автор

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.

judedavis
Автор

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

shadowrealm
Автор

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

chriswang
Автор

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

SerjCrimea