|
|
|
|
Are you trying to win contest "slowest container clearing"? Why not use .clear() member function? Or even just let vector destructor do its job? |
block.clear()
in my code but I found this info about the function:A reallocation is not guaranteed to happen, and the vector capacity is not guaranteed to change due to calling this function. |
Nevertheless, problem is probably caused that you messed with one of the object memory (buffer overflow ir something similar) and now when its destructor invoked, it tries to free wrong memory. |
So, I thought that might be the issue and changed up the way I was clearing the vector just to eliminate the possibility that that was the issue. |
Breakpoint 2, main () at eventfinder.cpp:122 122 FileIn_f.close(); (gdb) step 123 FileOut_f.close(); (gdb) step *** Error in `/home/preston/Desktop/Science/Research/ClampAnalyze/eventfinder/eventfinder': free(): invalid next size (normal): 0x0000000000608620 *** Program received signal SIGABRT, Aborted. 0x00007ffff722abb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) |
return 0;
is called in int main()
.
It seems unlikely to me that something deep in the interior of the program could produce an error at the end of the code |
ATF 1.0 7 4 "AcquisitionMode=Gap Free" "Comment=" "YTop=200000,200000,10" "YBottom=-200000,-200000,-10" "SweepStartTimesMS=0.000" "SignalsExported=IN 0,IN 4,IN 5" "Signals=" "IN 0" "IN 4" "IN 5" "Time (s)" "Trace #1 (pA)" "Trace #1 (pA)" "Trace #1 (V)" 0 -12.207 -30322.3 0.298462 1e-4 0 -30334.5 0.297852 2e-4 0 -30334.5 0.296936 3e-4 -18.3105 -30334.5 0.297546 4e-4 -18.3105 -30328.4 0.296936 5e-4 -6.10352 -30346.7 0.297852 6e-4 -18.3105 -30328.4 0.297241 7e-4 -24.4141 -30340.6 0.297852 |
|
|
block[i + blocklength - blockstart] = ReadRow( );
will write before actual vector buffer, potentually wrecking vector internals. (I actually was able to reproduce it by manually writing garbage before vector).