Skip to content

Bug: memory leak detected by weekly address sanitizer test in case 260_NO_DJ_PK_PU_SO #5039

@kirk0830

Description

@kirk0830

Describe the bug

Test case 260_NO_DJ_PK_PU_SO

On process id asan.95394

=================================================================
==95394==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 165888 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a9539357 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102
    #1 0x55f433f9e17d in XC_Functional::gradcorr(double&, double&, ModuleBase::matrix&, Charge const*, ModulePW::PW_Basis*, UnitCell const*, std::vector<double, std::allocator<double> >&, bool) /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_gradcorr.cpp:189
    #2 0x55f43421a2d8 in Stress_Func<double, base_device::DEVICE_CPU>::stress_gga(ModuleBase::matrix&, ModulePW::PW_Basis*, Charge const*) /__w/abacus-develop/abacus-develop/source/module_hamilt_pw/hamilt_pwdft/stress_func_gga.cpp:29
    #3 0x55f4347ab6f4 in Force_Stress_LCAO<std::complex<double> >::calStressPwPart(ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, double const&, Charge const*, ModulePW::PW_Basis*, Structure_Factor const&) /__w/abacus-develop/abacus-develop/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp:911
    #4 0x55f4347bdc0e in Force_Stress_LCAO<std::complex<double> >::getForceStress(bool, bool, bool, bool, Parallel_Orbitals&, elecstate::ElecState const*, psi::Psi<std::complex<double>, base_device::DEVICE_CPU> const*, Gint_Gamma&, Gint_k&, TwoCenterBundle const&, ModuleBase::matrix&, ModuleBase::matrix&, Structure_Factor const&, K_Vectors const&, ModulePW::PW_Basis*, ModuleSymmetry::Symmetry*) /__w/abacus-develop/abacus-develop/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp:133
    #5 0x55f434498ade in ModuleESolver::ESolver_KS_LCAO<std::complex<double>, std::complex<double> >::cal_force(ModuleBase::matrix&) /__w/abacus-develop/abacus-develop/source/module_esolver/esolver_ks_lcao.cpp:302
    #6 0x55f433f420e5 in Relax_Driver::relax_driver(ModuleESolver::ESolver*) /__w/abacus-develop/abacus-develop/source/module_relax/relax_driver.cpp:68
    #7 0x55f433f7c3dc in Driver::driver_run() /__w/abacus-develop/abacus-develop/source/driver_run.cpp:68
    #8 0x55f433f7522e in Driver::atomic_world() /__w/abacus-develop/abacus-develop/source/driver.cpp:186
    #9 0x55f433f7a4a6 in Driver::init() /__w/abacus-develop/abacus-develop/source/driver.cpp:40
    #10 0x55f4335d59da in main /__w/abacus-develop/abacus-develop/source/main.cpp:42

Direct leak of 4816 byte(s) in 7 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe7a8766bc6 in ompi_op_base_op_select (/lib/x86_64-linux-gnu/libmpi.so.40+0xd6bc6)

Direct leak of 4816 byte(s) in 7 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe766bd64fb  (<unknown module>)

Direct leak of 2760 byte(s) in 4 object(s) allocated from:
    #0 0x7fe7a9537a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fe768b8ec13  (<unknown module>)

Direct leak of 260 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe768bd6226  (<unknown module>)

Direct leak of 256 byte(s) in 2 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe768bee0f1  (<unknown module>)

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe768c72323  (<unknown module>)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe768bfa83d  (<unknown module>)

Direct leak of 44 byte(s) in 2 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe78e547157  (/lib/x86_64-linux-gnu/libc.so.6+0x88157)

Direct leak of 30 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a9537887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fe76659d4e6  (<unknown module>)

Direct leak of 22 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a94de9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7fe768b78f23  (<unknown module>)

Direct leak of 19 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a94de9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7fe7664dc570  (<unknown module>)
    #2 0x3335392e34393930  (<unknown module>)

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a94de9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7fe768b78d65  (<unknown module>)

Direct leak of 1 byte(s) in 1 object(s) allocated from:
    #0 0x7fe7a94de9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7fe7665d10f4  (<unknown module>)

SUMMARY: AddressSanitizer: 179029 byte(s) leaked in 31 allocation(s).

On process id asan.95395

=================================================================
==95395==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 165888 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eeffa357 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102
    #1 0x55dbb220817d in XC_Functional::gradcorr(double&, double&, ModuleBase::matrix&, Charge const*, ModulePW::PW_Basis*, UnitCell const*, std::vector<double, std::allocator<double> >&, bool) /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_gradcorr.cpp:189
    #2 0x55dbb24842d8 in Stress_Func<double, base_device::DEVICE_CPU>::stress_gga(ModuleBase::matrix&, ModulePW::PW_Basis*, Charge const*) /__w/abacus-develop/abacus-develop/source/module_hamilt_pw/hamilt_pwdft/stress_func_gga.cpp:29
    #3 0x55dbb2a156f4 in Force_Stress_LCAO<std::complex<double> >::calStressPwPart(ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, ModuleBase::matrix&, double const&, Charge const*, ModulePW::PW_Basis*, Structure_Factor const&) /__w/abacus-develop/abacus-develop/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp:911
    #4 0x55dbb2a27c0e in Force_Stress_LCAO<std::complex<double> >::getForceStress(bool, bool, bool, bool, Parallel_Orbitals&, elecstate::ElecState const*, psi::Psi<std::complex<double>, base_device::DEVICE_CPU> const*, Gint_Gamma&, Gint_k&, TwoCenterBundle const&, ModuleBase::matrix&, ModuleBase::matrix&, Structure_Factor const&, K_Vectors const&, ModulePW::PW_Basis*, ModuleSymmetry::Symmetry*) /__w/abacus-develop/abacus-develop/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp:133
    #5 0x55dbb2702ade in ModuleESolver::ESolver_KS_LCAO<std::complex<double>, std::complex<double> >::cal_force(ModuleBase::matrix&) /__w/abacus-develop/abacus-develop/source/module_esolver/esolver_ks_lcao.cpp:302
    #6 0x55dbb21ac0e5 in Relax_Driver::relax_driver(ModuleESolver::ESolver*) /__w/abacus-develop/abacus-develop/source/module_relax/relax_driver.cpp:68
    #7 0x55dbb21e63dc in Driver::driver_run() /__w/abacus-develop/abacus-develop/source/driver_run.cpp:68
    #8 0x55dbb21df22e in Driver::atomic_world() /__w/abacus-develop/abacus-develop/source/driver.cpp:186
    #9 0x55dbb21e44a6 in Driver::init() /__w/abacus-develop/abacus-develop/source/driver.cpp:40
    #10 0x55dbb183f9da in main /__w/abacus-develop/abacus-develop/source/main.cpp:42

Direct leak of 4816 byte(s) in 7 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ee227bc6 in ompi_op_base_op_select (/lib/x86_64-linux-gnu/libmpi.so.40+0xd6bc6)

Direct leak of 4816 byte(s) in 7 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ac6974fb  (<unknown module>)

Direct leak of 2760 byte(s) in 4 object(s) allocated from:
    #0 0x7f26eeff8a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f26ae64fc13  (<unknown module>)

Direct leak of 260 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ae697226  (<unknown module>)

Direct leak of 256 byte(s) in 2 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ae6af0f1  (<unknown module>)

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ae733323  (<unknown module>)

Direct leak of 57 byte(s) in 3 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26d400d157  (/lib/x86_64-linux-gnu/libc.so.6+0x88157)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ae6bb83d  (<unknown module>)

Direct leak of 30 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eeff8887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f26ac05e4e6  (<unknown module>)

Direct leak of 22 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eef9f9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7f26ae639f23  (<unknown module>)

Direct leak of 19 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eef9f9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7f26abf9d570  (<unknown module>)
    #2 0x3335392e34393930  (<unknown module>)

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eef9f9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7f26ae639d65  (<unknown module>)

Direct leak of 1 byte(s) in 1 object(s) allocated from:
    #0 0x7f26eef9f9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x7f26ac0920f4  (<unknown module>)

SUMMARY: AddressSanitizer: 179042 byte(s) leaked in 32 allocation(s).

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).

Metadata

Metadata

Assignees

Labels

BugsBugs that only solvable with sufficient knowledge of DFT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions