vendredi 3 septembre 2021

Recursion in destructor of std::regex in C++

I am using std::regex object as part of my class. We implemented them in CPP language on MacOS. As part of crash stack frame of class destructor, we noticed recursion of regex object. What may be the possible reason for this? Pls help me.

My sample class is

struct regexpression {
    std::regex r;
    uint64_t flag1;
    uint64_t flag2;
    bool a;
    bool b;
    bool b;
    regexpression(std::string reg, uint64_t set, uint64_t drop, bool aa=false, bool bb=false, bool cc=false) : r(reg), flag1(set), flag2(drop), a(aa), b(bb), c(cc) {
    }
};

My recursive regex stack frame is

Thread 259
0   libsystem_malloc.dylib          0x7fff2019222d      <unknown>
1   sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
2   sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
3   sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
4   sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
5   sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
6   sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
7   sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
8   sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
9   sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
10  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
11  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
12  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
13  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
14  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
15  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
16  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
17  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
18  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
19  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
20  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
21  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
22  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
23  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
24  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
25  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
26  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
27  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
28  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
29  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
30  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
31  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
32  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
33  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
34  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
35  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
36  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
37  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
38  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
39  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
40  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
41  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
42  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
43  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
44  sampleprc                        0x10b188155         [inlined] std::_1::r_anchor<T>::~_r_anchor (regex:1435)
45  sampleprc                        0x10b188155         [inlined] std::_1::owns_one_state<T>::~_owns_one_state (regex:1429)
46  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state (regex:1435)
47  sampleprc                        0x10b188155         [inlined] std::_1::empty_state<T>::~_empty_state
48  sampleprc                        0x10b188155         std::_1::r_anchor<T>::~_r_anchor (regex:1435)
49  sampleprc                        0x10b2e8497         [inlined] std::_1::shared_count::_release_shared (memory:3445)
50  sampleprc                        0x10b2e8497         [inlined] std::_1::shared_weak_count::_release_shared (memory:3487)
51  sampleprc                        0x10b2e8497         [inlined] std::__1::shared_ptr<T>::~shared_ptr (memory:4212)
52  sampleprc                        0x10b2e8497         [inlined] std::__1::shared_ptr<T>::~shared_ptr (memory:4210)
53  sampleprc                        0x10b2e8497         [inlined] std::__1::basic_regex<T>::~basic_regex (regex:2497)
54  sampleprc                        0x10b2e8497         [inlined] std::__1::basic_regex<T>::~basic_regex
55  sampleprc                        0x10b2e8497         [inlined] regexpression::~regexpression (sample.cpp:84)

Aucun commentaire:

Enregistrer un commentaire