Memory leaks when application is compiled with BOOST_DISABLE_THREADS
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách biên dịch test.cc được cung cấp cả khi có và khi không có BOOST_DISABLE_THREADS, sử dụng lệnh AddressSanitizer được nêu, rồi so sánh các báo cáo rò rỉ. Truy vết các cấp phát được báo cáo thông qua program_options::options_description_easy_init và bool_switch; hoàn thành khi giải thích được liệu macro có gây ra rò rỉ hay không và sửa được nó mà không tạo thêm rò rỉ trong cả hai bản build.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
There's a memory leak if an application is compiled with BOOST_DISABLE_THREADS, is this expected behaviour?
test.cc:
#include <boost/program_options.hpp>
int main(int argc, char *argv[]) {
boost::program_options::options_description opts{"Test"};
opts.add_options()
("help,h", boost::program_options::bool_switch(), "display this help and exit");
return 0;
}
Without BOOST_DISABLE_THREADS defined:
$ g++ -fsanitize=address test.cc -lboost_program_options -lboost_system -o test
$ ./test
$
With BOOST_DISABLE_THREADS defined:
$ g++ -fsanitize=address -DBOOST_DISABLE_THREADS test.cc -lboost_program_options -lboost_system -o test
=================================================================
==97000==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f675771777f in boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*) (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x3f77f)
Indirect leak of 176 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f6757732624 in boost::program_options::bool_switch(bool*) (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x5a624)
Indirect leak of 120 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f6757717761 in boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*) (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x3f761)
#2 0x7f6756d67b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
Indirect leak of 27 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f67577155fc (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x3d5fc)
Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f6757716593 in boost::program_options::option_description::option_description(char const*, boost::program_options::value_semantic const*, char const*) (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x3e593)
Indirect leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f6757a39458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
#1 0x7f67577326c5 in boost::program_options::bool_switch(bool*) (/usr/lib/x86_64-linux-gnu/libboost_program_options.so.1.65.1+0x5a6c5)
SUMMARY: AddressSanitizer: 387 byte(s) leaked in 6 allocation(s).
- Ngôn ngữ chính
- C++
- Star
- 136
- Fork
- 117
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của boostorg/program_options
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
boostorg/program_options#147 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
boostorg/program_options#146 ·
-
non static member shadows Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
boostorg/program_options#144 ·
-
problem with different quotes Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
boostorg/program_options#142 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
boostorg/program_options#139 ·
Tất cả issue của boostorg/program_options
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
games-on-whales/wolf#509 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug-unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100