当前位置:网站首页>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 install2. 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-libasanb) 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=0Then 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
边栏推荐
猜你喜欢

Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid

Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting

Unity3d Learning Notes 6 - GPU instantiation (1)

2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?

LM12丨Rolling Heikin Ashi二重K线滤波器

SAP HR 劳动合同信息 0016

Mysql索引优化实战一

在软件工程领域,搞科研的这十年!

电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级

B / Qurt Utilisateur Guide (36)
随机推荐
CAIP2021 初赛VP
Force deduction solution summary 648 word replacement
USB (XVII) 2022-04-15
Freelink open source call center design idea
LeeCode -- 6. Zigzag transformation
HDU 4747 Mex「建议收藏」
Sequence of entity layer, Dao layer, service layer and controller layer
B_ QuRT_ User_ Guide(40)
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
谷歌浏览器怎么登录及开启同步功能
MySQL Index Optimization Practice I
How to login and enable synchronization function in Google browser
KeePass realizes automatic input of web pages
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
欢聚时代一面
Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
Ros2 topic (03): the difference between ros1 and ros2 [02]
The 19th Zhejiang Provincial Collegiate Programming Contest 2022浙江省赛 F.EasyFix 主席树
进度播报|广州地铁七号线全线29台盾构机全部完成始发