Error: glibc

S

Stian Karlsen

Hi. I'm getting an error in my program. It doesn't occur each time even
if the same things happend in my program each time I run it. There will
however be different values used for calculations in the program. The
error happends suddenly and at different times. I load quiet alot of
data into my program.

I'm wondering if there are anyone witch are familiar with this sort of
error, and has some good ideas for what may be wrong. What is glibc?

I get two different variants of the error:

*** glibc detected *** double free or corruption (fasttop): 0x080ee090 ***

*** glibc detected *** corrupted double-linked list: 0x080e07b0 ***


....
Any help will be gladly accepted!

Best Regards,
Stian Karlsen
 
R

Rolf Magnus

Stian said:
Hi. I'm getting an error in my program. It doesn't occur each time even
if the same things happend in my program each time I run it. There will
however be different values used for calculations in the program. The
error happends suddenly and at different times. I load quiet alot of
data into my program.

I'm wondering if there are anyone witch are familiar with this sort of
error, and has some good ideas for what may be wrong. What is glibc?

glibc is the GNU implementation of the C standard library.
I get two different variants of the error:

*** glibc detected *** double free or corruption (fasttop): 0x080ee090 ***

Well, this is pretty much self-explanatory I'd say. You free the same block
of dynamically allocated memory twice.
*** glibc detected *** corrupted double-linked list: 0x080e07b0 ***

I'm not sure about this. It could mean that you overwrote the memory
manager's internal metadata by writing past the end of an array.

If you are on linux/x86, you should run your program in valgrind (a memory
debugger). It makes finding out the source of such memory handling errors a
lot easier. Be sure to have the compiler generate debug information.
 
S

Stian Karlsen

Rolf said:
Stian Karlsen wrote:




glibc is the GNU implementation of the C standard library.

Thanks.



Well, this is pretty much self-explanatory I'd say. You free the same block
of dynamically allocated memory twice.

I agree that this were rather self-explanatory. But I just can't believe
where I may do this, so I were confused by the glibc-thing. I guess I
have to start diving into the code :( ..
I'm not sure about this. It could mean that you overwrote the memory
manager's internal metadata by writing past the end of an array.

I don't even use arrays, so I don't think this should be the problem. I
have created by own linked list - not double though. But I didn't think
the compiler would recognice that my object were a linked list. Anyway
this should work, but .. well, perhaps not..
If you are on linux/x86, you should run your program in valgrind (a memory
debugger). It makes finding out the source of such memory handling errors a
lot easier. Be sure to have the compiler generate debug information.

Okay, thanks. I am on linux x86, and valgrind exists here, so I'll see
if I can figure out how it works.

Thanks for the answers!
 
R

Rolf Magnus

Stian said:
I don't even use arrays, so I don't think this should be the problem. I
have created by own linked list - not double though. But I didn't think
the compiler would recognice that my object were a linked list. Anyway
this should work, but .. well, perhaps not..

I think it is referring to an internal linked list of memory blocks that
memory managers often use. There is no way for the compiler to know that
your data structures are implementing a linked list. Anyway, if you
overwrite the list pointers of the memory manager's list (Be it by writing
beyond the end of an array or maybe to memory that was already deleted or
not yet allocated properly), the memory manager can get corrupt. This is a
common source for crashes that occur not where the bug is but at some
seemingly unrelated part of the program (often the next time you
(de-)allocate memory).
 
S

Stian Karlsen

Rolf said:
Stian Karlsen wrote:




I think it is referring to an internal linked list of memory blocks that
memory managers often use. There is no way for the compiler to know that
your data structures are implementing a linked list. Anyway, if you
overwrite the list pointers of the memory manager's list (Be it by writing
beyond the end of an array or maybe to memory that was already deleted or
not yet allocated properly), the memory manager can get corrupt. This is a
common source for crashes that occur not where the bug is but at some
seemingly unrelated part of the program (often the next time you
(de-)allocate memory).

Thanks again.

I know that this problem has occured before, but it became a problem
after I created a GUI with Qt for my program. So, perhaps there is
somthing in this witch makes the problem. But I guess the problem is
that, in my Qt application I can run the program over and over in the
same execution (it is the kind of program witch I just start, it does
some calculations and then it's finished). So perhaps there are
something witch is free'd in after the first running, and sometimes used
again later. But as I said this error just occurs now-and-then, and not
at the same time each time I run it...

Well, I think I have some debuging to do... Thanks for the help and
comments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top