-
Notifications
You must be signed in to change notification settings - Fork 615
Closed
Labels
Description
Describe the bug
When running the test with ASan enabled, it reports a lot of memory leaks.
To Reproduce
Steps to reproduce the bug:
- install clang-20 to build the project as documented in the librime-qjs project.
make clean
make debug CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address"
cd debug/test
ASAN_OPTIONS=detect_leaks=1 ./rime_test > rime_test.leak.log 2>&1
Expected behavior
There should not be any memory leak issue reported in running the tests.
Log
==87120==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x00010b6c5f9d in _Znwm+0x7d (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x6af9d)
#1 0x00010c5e195a in rime_gears_initialize() gears_module.cc:80
#2 0x00010c47842b in rime::ModuleManager::LoadModule(rime_module_t*) module.cc:32
#3 0x00010c48d3ce in rime::LoadModules(char const**) setup.cc:37
#4 0x00010c48d29f in rime::rime_default_initialize() setup.cc:30
#5 0x00010c47842b in rime::ModuleManager::LoadModule(rime_module_t*) module.cc:32
#6 0x00010c48d3ce in rime::LoadModules(char const**) setup.cc:37
#7 0x00010af419a6 in main rime_test_main.cc:15
#8 0x00011942b52d in start+0x1cd (dyld:x86_64+0x552d)
The full log file: rime_test.leak.log.zip
Package:
- OS: macOS 12.7.6 (Intel)
- Version: commit 1c23358 (tag: 1.13.1, origin/master, origin/HEAD, master)
Additional context
With the Squirrel frontend in the same system, it seems the memory leak problem does not happen in the built librime.dylib.
I guess there could be something wrong in the test setup code.