当前位置:网站首页>Banyan loan,
Banyan loan,
2022-07-27 03:34:00 【dongsijia】
Banyan loan dynamic memory space is developed in the heap , The space opened up on the stack area has a feature , That is, the space on the heap will not be released automatically after it is used up , Instead, a function is designed to release dynamic memory :free, Programmers need to actively call this function to free up space ;
Of course , When banyan loan closes the whole program , The operating system will automatically reclaim the dynamically developed memory ( That's why some computers fail, shut down and restart, and the problem is solved ); however , Banyan loans are used in large projects of some companies , Some programs need 7*24 Running in hours , For example, Tencent cloud and Alibaba cloud cloud cloud servers ;
And once banyan loan uses dynamic memory to open up functions , such as malloc、realloc、calloc When you forget to release after opening up space , Will cause memory leaks ( It's equivalent to you applying for a piece of space from memory , But you don't return it after you use it , So others can't use this space , Although this space still exists , But it's equivalent to no ), This is banyan loan, you will find , As the program continues to run , The memory available to us will become less and less ;
Memory leakage is the most common mistake we make in dynamic memory management , We need to attach great importance to .
The functionality
Banyan loans are used to release dynamically developed memory .
Function parameter
void free (void* ptr);
# void* ptr The starting address of the space you want to free ;
Function USES
on top malloc We have demonstrated the use of function , take p The address of is passed to free Function .
matters needing attention
If banyan loan parameters ptr The pointed space is not opened dynamically , that free The behavior of a function is undefined ;
If parameters ptr yes NULL The pointer , Then the function does nothing ;
边栏推荐
- PyCharm中Debug模式进行调试详解
- What are "full five unique" and "full two unique"? Any difference?
- Take you to know what Web3.0 is
- Spark Learning Notes (IV) -- spark core programming RDD
- MySQL中文失败问题
- Customer cases | pay attention to the elderly user experience, and the transformation of bank app to adapt to aging should avoid falsehood and be practical
- redis入门练习
- Activiti5.22.0扩展支持达国产数据库,以GBase据库为例
- 2022牛客多校第二场的J -- 三分做法
- 关于OpenFeign的源码分析
猜你喜欢

Pytoch loss function summary

$128million! IQM, a Finnish quantum computing company, was supported by the world fund

redis秒杀案例,跟着b站尚硅谷老师学习

The diagram of user login verification process is well written!

Deep learning vocabulary embedded, beam search
![[1206. Design skip table]](/img/a9/ca45c9fedd6e48387821bdc7ec625c.png)
[1206. Design skip table]

Add support for @data add-on in idea

LPCI-252通用型PCI接口CAN卡的功能和应用介绍

Quick sequencing and optimization

架构基本概念和架构本质
随机推荐
若依框架代码生成详解
Take you to know what Web3.0 is
LPCI-252通用型PCI接口CAN卡的功能和应用介绍
Submodule cache cache failure
阶乘末尾0的数量
若依的环境的部署以及系统的运行
记录一次,php程序访问系统文件访问错误的问题
unity游戏,隐私协议最简单解决方案!仅3行代码就搞定!(转载)
Data Lake (20): Flink is compatible with iceberg, which is currently insufficient, and iceberg is compared with Hudi
Pytoch loss function summary
【常用搜索问题】111
Detailed explanation of const usage in C language
30分钟彻底弄懂 synchronized 锁升级过程
Mysql database related operations
客户端发送一条sql如何与服务器交互
opiodr aborting process unknown ospid (21745) as a result of ORA-609
《稻盛和夫给年轻人的忠告》阅读笔记
spark:计算不同分区中相同key的平均值(入门级-简单实现)
Fastboot刷机
Explain详解