当前位置:网站首页>Develop those things: how to solve the memory leak in the conversion between go and C type?
Develop those things: how to solve the memory leak in the conversion between go and C type?
2022-07-20 12:46:00 【TSINGSEE】
Last time I shared with you about Go Add C.free Free memory , Solution to error reporting in compilation , Let's discuss with you today Go And C How to solve the memory leak in type conversion .
We found in the development process that , take Go character string 、byte Slice to C The corresponding string 、 Array time , If memory is not freed , Memory leakage will occur .
The solution is as follows :
When Go character string 、byte Slice to C The corresponding string 、 Array time , Due to the use malloc Allocate space , So you need to use C.free Free memory , Avoid memory leaks .
Verification process :
Just call C.CString Do not call C.free Free memory , After a few seconds , The memory rises to more than 20 M, And has been rising :
When calling the C.free After releasing memory , The memory of the program has been stable 7M about , Pictured :
stay CGO In the official document , stay CString And CBytes The Department also specifically pointed out , You need to free memory after using . Especially in video surveillance with high concurrency 、 In high-performance scenarios , We need to call relevant methods in time to release resources in time , Avoid temporary or permanent memory leaks , Thus affecting the normal use of the platform .
TSINGSEE Qingxi video focuses on the research and development of video streaming media technology , At present, diversified video platforms have been launched for the market , Such as EasyCVR、EasyGBS、EasyDSS、EasyNVR etc. , It can realize the access of multiple types of equipment 、 Multi protocol support 、 Multi format video stream output 、 Multi terminal platform compatibility , The platform can be applied to smart construction sites 、 Smart campus 、 Smart factory 、 Intelligent water conservancy 、 In scenarios such as smart communities . Interested users can go to the demonstration platform for experience or deployment testing .
边栏推荐
- 论文阅读:LinkNet: Exploiting Encoder Representations forEfficient Semantic Segmentation
- c语言远程连接mysql成功,无法插入数据
- Driud 配置问题
- NFT game interoperability: technology is not a roadblock
- [Mamba] is CONDA slow?
- Differences between PowerShell and CMD
- 论文阅读:Rethinking Atrous Convolution for Semantic Image Segmentation
- 广汽埃安新一轮引战增资正式预挂牌,资金将重点用于新产品开发、新一代电池等方面
- Description of neural network model - simple neural network model
- 【深度学习】pytorch使用tensorboard可视化实验数据
猜你喜欢
Hackers crack gambling website vulnerabilities and "collect wool" 100000 per month
Understand the trading volume and turnover rate in one article
EVO评估工具的使用
C语言之goto
[postponed to December] 2022 International Symposium on Cyber Security (csw2022)
NoSQL-Mongodb
Reflective Decoding: Beyond Unidirectional Generation with Off-the-Shelf Languag
Software of synonymous sentence conversion online translator
CDH之impala
Part 15: SPI serial communication protocol of stm32
随机推荐
Rancher安装部署及基本使用
flinksql 环境如何配置使用rocksdb啊
Filter setting of can
这些年我开源的几个小项目
Shuttle + alluxio accelerated memory shuffle take-off
Chinese synonymous sentence online converter - Chinese synonymous sentence converter software
Docker installs common software MySQL
第十四篇,STM32的CAN总线通信
微服务--熔断和限流
phpcms添加多文本属性字段_详细教程
UE GIS virtualization learning
【通信】【2】《宽带太赫兹通信技术》的笔记和一些简单的词汇的意思(误
上海证券开户安不安全?
出于对员工人身安全的担忧 星巴克未来可能关闭更多美国门店
Part 14: can bus communication of stm32
广汽埃安新一轮引战增资正式预挂牌,资金将重点用于新产品开发、新一代电池等方面
数字沙盘的三大应用功能科普
【延期公告】2022年网络与信息安全国际会议(NISecurity 2022)
Phpcms add multi text attribute field_ Detailed tutorial
CorelDRAWX8试用到期了怎么免费使用?cdrX8