当前位置:网站首页>JNI uses asan to check memory leaks
JNI uses asan to check memory leaks
2022-07-07 23:33:00 【halem100】
background
If JVM Some molecular modules belong to C++ Written so, You need to check for memory leaks , Provided here ASAN To check this so
resolvent
1.asan install
asan need gcc 4.8 Support for the above versions , If the experimental machine gcc The version is not high enough , Manual installation required gcc4.8 Version above , If the machine cannot be networked , You can download it manually first gcc Source package , Then compile the source code
tar xvf gcc-4.9.0.tar.gz
cd gcc-4.9.0
sudo yum install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel
sudo ./configure --prefix=/usr/local/gcc-4.9.0 --enable-threads=posix --disable-checking --disable-multilib
sudo make
sudo make install
2. Service deployment and startup
a) Compiling band asan Of so
makefile modify :
CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -static-libasan
LIBFLAG += -fsanitize=address -static-libasan
b) Preset environment variables
export ASAN_OPTIONS=detect_leaks=1:halt_on_error=0:handle_segv=0:log_path=/tmp/asan.log
export LD_PRELOAD=/usr/local/gcc-4.9.0/lib64/libasan.so
export LSAN_OPTIONS=exitcode=0
Then deploy normally .
3. Memory problem check
After the service starts and runs for several times ,top command , Find service process id,kill -2 <pid>, After the process exits , see /tmp/asan.log.<pid> file , Information about existing memory leaks
边栏推荐
- turbo intruder常用脚本
- V-for traversal object
- As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
- The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
- HDU 4747 Mex「建议收藏」
- The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
- Solution: prompt "unsupported video format" when inserting avi format video into the message
- 违法行为分析1
- Turbo introder common scripts
- Right click the idea file to create new. There is no solution to create new servlet
猜你喜欢
Vulnerability recurrence ----- 49. Apache airflow authentication bypass (cve-2020-17526)
LDO voltage stabilizing chip - internal block diagram and selection parameters
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」
包装行业智能供应链S2B2B商城解决方案:开辟电商消费新生态
LeeCode -- 6. Zigzag transformation
B_ QuRT_ User_ Guide(38)
Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
Summary of SQL single table query 2020.7.27
Spark 离线开发框架设计与实现
2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
随机推荐
leetcode-520. Detect capital letters -js
B_QuRT_User_Guide(37)
JS get the key and value of the object
Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
Turbo introder common scripts
违法行为分析1
windows设置redis开启自动启动
USB (XVI) 2022-04-28
进度播报|广州地铁七号线全线29台盾构机全部完成始发
统计电影票房排名前10的电影并存入还有一个文件
Opencv scalar passes in three parameters, which can only be displayed in black, white and gray. Solve the problem
Explain
MATLAB signal processing [Q & A essays · 2]
B_ QuRT_ User_ Guide(40)
高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
8.31 Tencent interview
B_QuRT_User_Guide(38)
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
云原生正在吞噬一切,开发者该如何应对?