当前位置:网站首页>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
边栏推荐
- Live-Server使用
- 在软件工程领域,搞科研的这十年!
- Spark 离线开发框架设计与实现
- 谷歌浏览器怎么登录及开启同步功能
- sql 数据库执行问题
- SRM supplier cloud collaborative management platform solution for building materials industry to realize business application scalability and configuration
- B_QuRT_User_Guide(40)
- How to login and enable synchronization function in Google browser
- S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
- 经纬度PLT文件格式说明
猜你喜欢

Lm12 rolling heikin Ashi double K-line filter

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held

电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
![Ros2 topic (03): the difference between ros1 and ros2 [01]](/img/20/39d47c93400050a7bc8ad7efea51b3.png)
Ros2 topic (03): the difference between ros1 and ros2 [01]

First week of July

Markdown

B_ QuRT_ User_ Guide(38)

漏洞复现----49、Apache Airflow 身份验证绕过 (CVE-2020-17526)

Understand TCP's three handshakes and four waves with love

Unity3d Learning Notes 6 - GPU instantiation (1)
随机推荐
Progress broadcast | all 29 shield machines of Guangzhou Metro Line 7 have been launched
Right click the idea file to create new. There is no solution to create new servlet
Installing spss25
包装行业智能供应链S2B2B商城解决方案:开辟电商消费新生态
云原生正在吞噬一切,开发者该如何应对?
ROS2专题(03):ROS1和ROS2的区别【01】
re1攻防世界逆向
Unity3d learning notes 5 - create sub mesh
Have all the fresh students of 2022 found jobs? Is it OK to be we media?
LDO voltage stabilizing chip - internal block diagram and selection parameters
Solve the problem of duplicate request resource paths /o2o/shopadmin/o2o/shopadmin/getproductbyid
违法行为分析1
Coreseek: the second step is index building and testing
Fibonacci number of dynamic programming
Caip2021 preliminary VP
Extended tree (I) - graphic analysis and C language implementation
New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
StringUtils工具类
深入理解Mysql锁与事务隔离级别
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting