google / sanitizers

AddressSanitizer, ThreadSanitizer, MemorySanitizer
Other
11.5k stars 1.04k forks source link

std::localtime detected memory leaks #1548

Open jiemojiemo opened 2 years ago

jiemojiemo commented 2 years ago

it is strange...

image
jiemojiemo commented 2 years ago

some discussion about this: https://stackoverflow.com/questions/23541583/localtime-r-consuming-some-memory-before-program-exit

so how to avoid this ? help...

Enna1 commented 2 years ago

I didn't reproduce this, https://godbolt.org/z/cG33dj17d

jiemojiemo commented 2 years ago

more details about my system:

compiler : clang 13, -DCMAKE_CXX_COMPILER=/opt/homebrew/Cellar/llvm@13/13.0.1/bin/clang++ os: macos monterey, apple m1 pro

Enna1 commented 2 years ago

you can check this, if you want to suppress this leak. https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions

jiemojiemo commented 2 years ago

you can check this, if you want to suppression this leak. https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions

Thanks! you save my day!

Enna1 commented 2 years ago

More, you can also specify the suppression list at source code level:

extern "C"
const char *__lsan_default_suppressions() {
  return "leak:*LSanTestLeakingFunc*";
}