Memory Manage Together
介绍
Memory Manage Together
本项目主要记录各类在C/C++使用过程中,有关内存的各种事项。
如:
- 内存泄漏 memory leak
- 内存溢出 out of memory
- 访问越界 access violation
- 等等
展现形式
本仓库是一个 sample 的整合,不会涉及过多内部的底层设计等等。
一切回归到最接近每位coder的层面,一份文件一般对应一种问题。
辅助工具
关于检测内存问题的工具有很多。
这里推荐 Valgrind Home
# linux 环境下
# 默认生成 a.out
gcc ./main.c
# 对 a.out 文件进行检测
valgrind ./a.out
# 将检测信息打到文件中
# valgrind_out.log 不会自动创建
valgrind --log-file=valgrind_out.log ./a.out
交流合作
QQ群:817328828
本项目致力于打造为一个拥有丰富例子的仓库。
有各种有趣的场景或者idea可以直接提交issues。
已有资源
-
array
- mismatch_arrayLength
-
class
- copy_useDeepCopy
- polymorphism_memoryTruncation
- polymorphism_upcasting
- polymorphism_vptr
- polymorphism_withoutVirtualDestructor
-
delete-free
- dereference_useWhenGetStorage
- doubleFree
- forget_freeOrDelete
- invalidFree
- mismatch_delete
- mismatch_freeAndDelete
-
exception
- exception_evaluationOrder
-
null-pointer
- invalidAddress
-
reference
- reference_extendTheLifeCycle
-
smartptr
- circular-reference_00
- circular-reference_01
-
stl
- pointer-element
- vector-bool
-
~other
- mismatch_byteLength
- parameterList
- recursive
- union