Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-02-2010, 10:59 AM   #1
LQ Newbie
Registered: Jul 2005
Posts: 10

Rep: Reputation: 0
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.

Old 03-02-2010, 01:46 PM   #2
LQ Newbie
Registered: Jul 2005
Posts: 10

Original Poster
Rep: Reputation: 0
seems ive solved it. the array wasnt being initialised (allocated) properly.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What does this error mean? double free or corruption nanxy Programming 6 08-10-2008 11:26 AM
Urgent: glibc detected *** double free or corruption error when creating ms_newMapobj SteevN Linux - General 0 04-01-2008 07:52 AM
*** glibc detected *** double free or corruption - ERROR bandwidthjunkie Programming 2 03-19-2007 09:36 AM
Open Office user install error: *** glibc detected *** double free or corruption: 0xb r_jensen11 Linux - General 6 01-16-2005 06:08 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration