Detect C++ Memory Leaks with ALSan: Attachable Leak Sanitizer - Bojun Seo - C++Now 2024

  Рет қаралды 2,425

CppNow

CppNow

Күн бұрын

Пікірлер: 5
@paulfloyd9258
@paulfloyd9258 Ай бұрын
Some Valgrind comments. Attaching is possible if the guest is running in Valgrind and you use vgdb. You can request leak reports at any time using client requests (either in instrumented code or vgdb again). Valgrind categorizes pointers that point inside a memory block as 'probable leaks'.
@szaszm_
@szaszm_ Ай бұрын
Good talk! I don't fully agree with calling out using raw pointers in general. Instead, my preferred approach is the following: Always consider the nullability and the ownership semantics of each pointer. - A nullable, non-owning pointer is T* (or T* const when possible) - A non-nullable, non-owning pointer is T& (where const works) or gsl::not_null (where you need to mutate the pointer, e.g. data members) - A nullable, owning pointer is std::unique_ptr (const when possible) - A non-nullable, owning pointer is gsl::not_null (const when possible) - When a legacy or C API returns an owning raw pointer, wrap it in gsl::owner or std::unique_ptr on the language or module boundary - When a legacy or C API forces you to use a raw pointer type on an interface for non-nullable parameters, document the assumption with gsl_Expects(ptr) or gsl_ExpectsAudit(ptr) Additionally, always null-check nullable pointer parameters inside functions. And try passing non-nullable, non-owning references/pointers to functions whenever possible, so there is less room for error.
@paulfloyd9258
@paulfloyd9258 Ай бұрын
Do you think that this could also be done with DTrace?
@BojunSeo-tx2df
@BojunSeo-tx2df Ай бұрын
It seems like to be possible to be done with DTrace I guess.
System Jitter and Where to Find It: A Whack-a-Mole Experience
27:17
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 12 МЛН
Sqlite Is Getting So Good
28:52
ThePrimeTime
Рет қаралды 205 М.
Derek Jones - "Benchmarking C++ compilers" - C++ London
44:29
Fix a memory leak in Flutter (#148291)  | Building Flutter
1:06:27
Flutter Bounty Hunters
Рет қаралды 8 М.
Is C++ better than C?
1:46:10
Tsoding Daily
Рет қаралды 50 М.
«Осень». Самая большая загадка Windows XP
14:36
Девять десятых
Рет қаралды 1,3 МЛН
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 233 М.
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН