forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Description
Describe the Code Quality Issue
The following memory leak is found with valgrind in tests/integrate/116_PW_scan_Si2:
Direct leak of 12728 byte(s) in 1 object(s) allocated from:
#0 0x7f1974c13337 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102
#1 0x5607ab3a062f in Stress_Func<double, psi::DEVICE_CPU>::stress_kin(ModuleBase::matrix&, ModuleBase::matrix const&, ModuleSymmetry::Symmetry*, K_Vectors*, ModulePW::PW_Basis_K*, psi::Psi<std::complex<double>, psi::DEVICE_CPU> const*) /abacus-develop/source/module_hamilt_pw/hamilt_pwdft/stress_func_kin.cpp:41
#2 0x5607ab3b5a19 in Stress_PW<double, psi::DEVICE_CPU>::cal_stress(ModuleBase::matrix&, UnitCell&, ModulePW::PW_Basis*, ModuleSymmetry::Symmetry*, Structure_Factor*, K_Vectors*, ModulePW::PW_Basis_K*, psi::Psi<std::complex<double>, psi::DEVICE_CPU> const*, psi::Psi<std::complex<double>, psi::DEVICE_CPU> const*) /abacus-develop/source/module_hamilt_pw/hamilt_pwdft/stress_pw.cpp:64
#3 0x5607ab49f9f5 in ModuleESolver::ESolver_KS_PW<std::complex<double>, psi::DEVICE_CPU>::cal_Stress(ModuleBase::matrix&) /abacus-develop/source/module_esolver/esolver_ks_pw.cpp:748
#4 0x5607ab1a318a in Relax_Driver<double, psi::DEVICE_CPU>::relax_driver(ModuleESolver::ESolver*) /abacus-develop/source/module_relax/relax_driver.cpp:67
#5 0x5607ab1d4857 in Driver::driver_run() /abacus-develop/source/driver_run.cpp:63
#6 0x5607ab1d0aa0 in Driver::atomic_world() /abacus-develop/source/driver.cpp:92
#7 0x5607ab1d30c8 in Driver::init() /abacus-develop/source/driver.cpp:32
#8 0x5607aac3e0d3 in main /abacus-develop/source/main.cpp:18
Additional Context
No response
Task list for Issue attackers
- Identify the specific code file or section with the code quality issue.
- Investigate the issue and determine the root cause.
- Research best practices and potential solutions for the identified issue.
- Refactor the code to improve code quality, following the suggested solution.
- Ensure the refactored code adheres to the project's coding standards.
- Test the refactored code to ensure it functions as expected.
- Update any relevant documentation, if necessary.
- Submit a pull request with the refactored code and a description of the changes made.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels