Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Visual Leak Detector (VLD) to improve code quality / 利用VLD检查代码内存泄漏 #9

Open
crazyzlj opened this issue Mar 27, 2017 · 0 comments
Assignees
Labels

Comments

@crazyzlj
Copy link
Contributor

crazyzlj commented Mar 27, 2017

利用Visual Leak Detector (VLD) 2.5.1 检查了模型框架代码的内存泄漏问题

代码更改详见pull7

其实说白了内存泄漏就是没有把new和delete配对使用,但是实际编码中,尤其是涉及复杂类与类之间相互调用的时候,理清什么时候释放哪块内存是不太容易的。

我这次主要检查了数组、含有自定义数据类型(或类实例)的容器(vector,map等)以及复杂类的释放及析构函数,这些可能涵盖了我们日常编程常见的内存泄漏问题。

对于复杂类的编写,大家要遵循“Rules of three”原则,即如果你的类需要以下任意一个函数,那么就请显式写出所有三个:

  • 复制构造函数(Copy Constructor)
  • 赋值操作符(Assignment Operator)
  • 析构函数(Destructor)

这里扩展阅读

当然,代码依然存在潜在问题,大家在扩充模块的同时,也可以多多关注框架的bug,并修复。

@crazyzlj crazyzlj self-assigned this Mar 31, 2017
@crazyzlj crazyzlj changed the title using Visual Leak Detector (VLD) to improve your code quality [Protocol] Using Visual Leak Detector (VLD) to improve code quality Mar 31, 2017
@crazyzlj crazyzlj changed the title [Protocol] Using Visual Leak Detector (VLD) to improve code quality [Protocol] Using Visual Leak Detector (VLD) to improve code quality / 利用VLD检查代码内存泄漏 Mar 31, 2017
@crazyzlj crazyzlj changed the title [Protocol] Using Visual Leak Detector (VLD) to improve code quality / 利用VLD检查代码内存泄漏 Using Visual Leak Detector (VLD) to improve code quality / 利用VLD检查代码内存泄漏 Mar 31, 2017
crazyzlj added a commit that referenced this issue Aug 15, 2023
13444638 Merge pull request #9 from crazyzlj/dev
c78b3437 (bugfix):set installation related paths to cache

git-subtree-dir: seims/src/ccgl
git-subtree-split: 134446389c1c51c8cfd2d063e119663e0c72e8da
crazyzlj added a commit that referenced this issue Nov 21, 2024
f55a618e [ci skip] Merge commit '8d31c4cf074efa132e8f8b4ea083507b2fa634da' into dev
8d31c4cf Squashed 'cmake/' changes from 2c2cf3f..2c05601
c11f6de7 update github actions to use Node.js 20 [ci skip]
cc7c6c8f update to the latest master [ci skip]
9c857bb6 Typo fixed of IMAGE_TAG, using github.ref == 'refs/heads/master'
20a046d3 Merge pull request #14 from crazyzlj/dev
002902e1 deploy images after the success of build and test
77608eba Update dockerfiles
57f33486 Backup previous used workflow for deploying images
9eab234e Remove links to dockerfiles
cce3f0de Ignore for docker build process
308a8df2 Change mongo-c-driver download path
45439f66 update to the latest master branch
dc331ec5 Merge branch 'master' of github.com:crazyzlj/CCGL
e085ab46 Update gdal version; use default version using ankane/setup-mongodb
411ba9a3 Merge pull request #13 from crazyzlj/dev
b3f9c929  remove --platform=$BUILDPLATFORM
39fbff55 Merge pull request #12 from crazyzlj/dev
6bce8436 Use FROM --platform=$BUILDPLATFORM xxx as builder; Add provenance: false for docker/build-push-action
460a0834 Merge pull request #11 from crazyzlj/dev
415c1280 Update how to use CCGL with MongoDB in docker
f50d3f99 Copy ccgl to /usr/local directories
55635670 Remove dockerfiles that running gtest of ccgl
c46ba95d Build amd64 and arm64 versions
c18889e3 Update gdal image from ghcr
ece54d09 test all image versions
3e2f3334 test mongodb on macos-latest
e2b12743 test tags for acr and ghcr
b7652b48 test ankane/setup-mongodb on macos
a8000c93 test acr and ghcr
b54e60de only test ghcr
506a1a96 test permissions write-all
91112103 test
e7791ea7 test ci
14568e41 Test again
533a4483 Test push images to ACR and ghcr
0190e958 Test push images to ACR and ghcr
9f3a4509 Test push images to ACR and ghcr
e33f3873 Merge pull request #10 from crazyzlj/dev
4c705a08 add deploy docker images to ghcr.io
43a91748 add deploy docker images to ghcr.io
82933b02 add deploy docker images to ghcr.io
13444638 Merge pull request #9 from crazyzlj/dev
c78b3437 (bugfix):set installation related paths to cache
35998ae0 Merge pull request #8 from crazyzlj/dev
e9478086 (bugfix):only support mongo-c-driver-1.5.0+ to use mongoc_collection_find_with_opts
8c3db8f1 Merge pull request #7 from crazyzlj/dev
f163d02b Squashed 'cmake/' changes from 8a954e2..2c2cf3f
52707277 Merge commit 'f163d02bd16f45d53927393d63e7a506c0e21ec1' into dev
ea3b1661 (bugfixed): default nodata should depends on data type of clsRasterData
21ce5201 (feat/experimental): Add support of Sanitizers
314dee89 (bugfix): delete tm correctly
fe0630dc (bugfix): fixed memory leak on MSVC
738b8028 merge latest master
e74c4cca Bug fixed on GDAL 1.x & 2.x
c4997932 Add CODECOV_TOKEN
fa7d7229 Add GDAL data types added from versions 3.5 & 3.7
c797e3e5 Test passed on Xcode

git-subtree-dir: seims/src/ccgl
git-subtree-split: f55a618e2e84c0416b0d9436185a023ba838c932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant