当前位置:网站首页>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
边栏推荐
- Matlab SEIR infectious disease model prediction
- 伸展树(一) - 图文解析与C语言实现
- leetcode-520. Detect capital letters -js
- ROS2专题(03):ROS1和ROS2的区别【02】
- 2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
- Right click the idea file to create new. There is no solution to create new servlet
- Design and implementation of spark offline development framework
- S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
- 2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
- As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
猜你喜欢
LeeCode -- 6. Z 字形变换
Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
SAP HR 家庭成员信息
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
建筑建材行业SRM供应商云协同管理平台解决方案,实现业务应用可扩展可配置
ESP at installation esp8266 and esp32 versions
LeeCode -- 6. Zigzag transformation
PCI-Express接口的PCB布线规则
S2b2b mall solution of intelligent supply chain in packaging industry: opening up a new ecosystem of e-commerce consumption
ROS2专题(03):ROS1和ROS2的区别【01】
随机推荐
How to login and enable synchronization function in Google browser
B_QuRT_User_Guide(39)
The text editor of markdown class should add colors to fonts (including typora, CSDN, etc.)
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
三问TDM
PCI-Express接口的PCB布线规则
System design overview
B_ QuRT_ User_ Guide(36)
HDU 4747 mex "recommended collection"
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
Coreseek:第二步建索引及測试
USB (XVII) 2022-04-15
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
LDO穩壓芯片-內部框圖及選型參數
产业共融新势能,城链科技数字峰会厦门站成功举办
B_QuRT_User_Guide(36)
违法行为分析1
Puce à tension stabilisée LDO - schéma de bloc interne et paramètres de sélection du modèle
SAP 内存参数调优过程
Design and implementation of spark offline development framework