Skip to content

Conversation

@A-006
Copy link
Collaborator

@A-006 A-006 commented Dec 24, 2024

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

  • Initialize the member variables that are not initialized in the class constructor.
  • Add assertions for pointers that may be null in the function.
  • use size_t instead of int as the result of STL find
    with the check of the Tscancode,most of the init value has been delete.
    before
    图片
    图片
    Uploading 图片.png…

after:The remaining part does not show any issues. It was a false alarm in the code check. There might be some grammatical format issues that can be reviewed again
图片

@A-006 A-006 marked this pull request as draft December 24, 2024 08:34
@A-006 A-006 marked this pull request as ready for review December 25, 2024 13:32
@A-006 A-006 changed the title Refactor: decrease uninitialized member values and the risk of memory leaks in the abacus. Refactor: decrease uninitialized member values and the risk of memory leaks in abacus Dec 25, 2024
@mohanchen mohanchen added the The Absolute Zero Reduce the "entropy" of the code to 0 label Dec 26, 2024
@mohanchen mohanchen merged commit 6fadfb9 into deepmodeling:develop Dec 31, 2024
14 checks passed
Fisherd99 pushed a commit to Fisherd99/abacus-BSE that referenced this pull request Mar 31, 2025
… leaks in abacus (deepmodeling#5755)

* init variable and fix memory leak bug in module_base

* fix uninit member var in module_basis

* chang logic bug and uninit memeber value in the module cell

* chang logic bug and uninit memeber value in the module_elecstate

* chang logic bug and uninit memeber value in the module_eslover

* chang memory leak risk and uninit memeber value in the module_hamilt_general

* chang  uninit memeber value in the module_hamilt_lcao

* chang  uninit memeber value in the module_hamilt_pwdft

* fix in klist

* [pre-commit.ci lite] apply automatic fixes

* fix useless assert

* revert change in read_pp_upf100.cpp

* change uninit memeber value in module_hamilt_pw

* change uninit memeber value in module_hsolver

* change uninit memeber value in module_io

* change uninit memeber value in module_md and module_relax

* [pre-commit.ci lite] apply automatic fixes

* update nnr init data

* fix uninit member value

* update value in elecstate_energy.cpp

* add init parameter for construct in sto_func

* add value in the construct file

* [pre-commit.ci lite] apply automatic fixes

* change magnetism.cpp

* [pre-commit.ci lite] apply automatic fixes

* modify logic of elecstate_energy.cpp

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants