当前位置:网站首页>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
边栏推荐
- System design overview
- Turbo introder common scripts
- USB (XV) 2022-04-14
- Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
- [STM32 + esp-12s connect Tencent cloud IOT development platform 1] creation of cloud platform and burning of at firmware
- SAP HR 家庭成员信息
- Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."
- Oracle database backup and recovery
- Happy gathering time
- leetcode-520. Detect capital letters -js
猜你喜欢
MySQL Index Optimization Practice II
Understand TCP's three handshakes and four waves with love
Add data analysis tools in Excel
SRM supplier cloud collaborative management platform solution for building materials industry to realize business application scalability and configuration
leetcode-520. Detect capital letters -js
Explain
2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
B_QuRT_User_Guide(38)
Spark 离线开发框架设计与实现
B_ QuRT_ User_ Guide(37)
随机推荐
经纬度PLT文件格式说明
USB (XIV) 2022-04-12
The efficient s2b2c e-commerce system helps electronic material enterprises improve their adaptability in this way
伸展树(一) - 图文解析与C语言实现
B_ QuRT_ User_ Guide(39)
LeeCode -- 6. Z 字形变换
How to login and enable synchronization function in Google browser
13、 System optimization
Oracle database backup and recovery
Spark 离线开发框架设计与实现
SAP HR 家庭成员信息
Unity3d learning notes 5 - create sub mesh
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."
Design and implementation of spark offline development framework
B_QuRT_User_Guide(39)
Force deduction solution summary 648 word replacement
Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
违法行为分析1
How to generate unique file names
ESP at installation esp8266 and esp32 versions