memory management - How to solve *** glibc detected *** free(): invalid pointer: -
i using valarray class , following error:
*** glibc detected *** /pathatomyproject/debug/boundaryelements: free(): invalid pointer: 0x0000000000608dd0 *** ======= backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f40bb272b96] ======= memory map: ======== 00400000-00408000 r-xp 00000000 08:01 80874818 00608000-00609000 r--p 00008000 08:01 80874818 00609000-0060a000 rw-p 00009000 08:01 80874818 00ee3000-00f04000 rw-p 00000000 00:00 0 [heap] 7f40bb1f4000-7f40bb3a9000 r-xp 00000000 08:01 81527681 /lib/x86_64-linux-gnu/libc-2.15.so 7f40bb3a9000-7f40bb5a8000 ---p 001b5000 08:01 81527681 /lib/x86_64-linux-gnu/libc-2.15.so 7f40bb5a8000-7f40bb5ac000 r--p 001b4000 08:01 81527681 /lib/x86_64-linux-gnu/libc-2.15.so 7f40bb5ac000-7f40bb5ae000 rw-p 001b8000 08:01 81527681 /lib/x86_64-linux-gnu/libc-2.15.so 7f40bb5ae000-7f40bb5b3000 rw-p 00000000 00:00 0 7f40bb5b3000-7f40bb5c8000 r-xp 00000000 08:01 81530362 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f40bb5c8000-7f40bb7c7000 ---p 00015000 08:01 81530362 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f40bb7c7000-7f40bb7c8000 r--p 00014000 08:01 81530362 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f40bb7c8000-7f40bb7c9000 rw-p 00015000 08:01 81530362 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f40bb7c9000-7f40bb8c4000 r-xp 00000000 08:01 81527692 /lib/x86_64-linux-gnu/libm-2.15.so 7f40bb8c4000-7f40bbac3000 ---p 000fb000 08:01 81527692 /lib/x86_64-linux-gnu/libm-2.15.so 7f40bbac3000-7f40bbac4000 r--p 000fa000 08:01 81527692 /lib/x86_64-linux-gnu/libm-2.15.so 7f40bbac4000-7f40bbac5000 rw-p 000fb000 08:01 81527692 /lib/x86_64-linux-gnu/libm-2.15.so 7f40bbac5000-7f40bbba7000 r-xp 00000000 08:01 45620408 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f40bbba7000-7f40bbda6000 ---p 000e2000 08:01 45620408 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f40bbda6000-7f40bbdae000 r--p 000e1000 08:01 45620408 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f40bbdae000-7f40bbdb0000 rw-p 000e9000 08:01 45620408 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 7f40bbdb0000-7f40bbdc5000 rw-p 00000000 00:00 0 7f40bbdc5000-7f40bbde7000 r-xp 00000000 08:01 81530272 /lib/x86_64-linux-gnu/ld-2.15.so 7f40bbfbc000-7f40bbfc1000 rw-p 00000000 00:00 0 7f40bbfe4000-7f40bbfe7000 rw-p 00000000 00:00 0 7f40bbfe7000-7f40bbfe8000 r--p 00022000 08:01 81530272 /lib/x86_64-linux-gnu/ld-2.15.so 7f40bbfe8000-7f40bbfea000 rw-p 00023000 08:01 81530272 /lib/x86_64-linux-gnu/ld-2.15.so 7fffe821b000-7fffe823c000 rw-p 00000000 00:00 0 [stack] 7fffe8331000-7fffe8332000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
and error happens ate point, when use copy constructor:
coords(const coords& coord){ this->order = coord.order; this->x = coord.x; this->y = coord.y; this->node = new unsigned int[order + 1]; (int ii = 0; ii < (order + 1); ii++) this->node[ii] = coord.node[ii]; this->reg = coord.reg; }
how can solve it, please? i've looked @ many places , found use valgrind, guess not necessary, since using std class.
Comments
Post a Comment