-   Programming (
-   -   runtime error ( double free or corruption (out)) mid way through reading in file (

quantum_leaf 03-02-2010 10:59 AM

runtime error ( double free or corruption (out)) mid way through reading in file

I writing a function that reads in data from a file into a 2dfloat array.

the loop:
ifstream inf;;

for(int i=0;i<1;i++){
for(int j=0;j<420;j++){
cout<<"ij "<<i<<" "<<j<<" inf"<<info[i][j]<<endl;


run fine up to i=0, j=417

and then crashes on 418. The backtrace begins:

*** glibc detected *** ./build/viewSelector: double free or corruption (out): 0x0000000001b6ac30 ***
======= Backtrace: =========
/usr/lib/ seRSt12_Ios_IostateRf+0x14a)[0x7fd40ca9447a]
======= Memory map: ========
00400000-00d59000 r-xp 00000000 09:01 7815172 /home/zoizoi/sunLoom/psyforge/VAS/build/viewSelector
00f59000-00f5a000 r--p 00959000 09:01 7815172 /home/zoizoi/sunLoom/psyforge/VAS/build/viewSelector
00f5a000-00f67000 rw-p 0095a000 09:01 7815172 /home/zoizoi/sunLoom/psyforge/VAS/build/viewSelector
00f67000-00f6d000 rw-p 00f67000 00:00 0
01b57000-01b78000 rw-p 01b57000 00:00 0 [heap]
410a8000-410aa000 rwxp 00000000 00:0f 750 /dev/zero
7fd404000000-7fd404021000 rw-p 7fd404000000 00:00 0
7fd404021000-7fd408000000 ---p 7fd404021000 00:00 0
7fd40a5a2000-7fd40a5a7000 r-xp 00000000 09:00 16108 /usr/lib/
7fd40a5a7000-7fd40a7a6000 ---p 00005000 09:00 16108 /usr/lib/

note, there is nothing special about float 418, it was output to the file in a similar loop and is only a fraction of the way into the file.

I am wondering whether this is likely to be a problem with my code or a problem with a dependency/libstd.


quantum_leaf 03-02-2010 01:46 PM

seems ive solved it. the array wasnt being initialised (allocated) properly.

All times are GMT -5. The time now is 10:58 AM.