Solved

Core dump when calling a library

Posted on 2006-06-26
3
562 Views
Last Modified: 2012-06-27
Hello,

I keep getting a core dump when running a C++ application on Linux. Here is part of the result upon checking the core file:

gdb someapp core.1234
GNU gdb 6.0-2mdk (Mandrake Linux)
.....
Core was generated by `/home/someone/someapp'.
Program terminated with signal 11, Segmentation fault.
......
(gdb) bt
#0  0x40bfeee1 in posix_memalign () from /lib/tls/libc.so.6
#1  0x40bfc777 in mallopt () from /lib/tls/libc.so.6
#2  0x40bfb9be in calloc () from /lib/tls/libc.so.6
#3  0x4050ad05 in QImage::setNumColors(int) () from /usr/lib/qt3/lib/libqt-mt.so.3
#4  0x00000400 in ?? ()
#5  0x00000001 in ?? ()

What do frames #4 & #5 really mean? The memory is corrupted? Because when I ran:
(gdb) x 0x00000400
I got:
0x400:  Cannot access memory at address 0x400

What might have caused the core dump? Can anyone shed some light on this? Thanks.

0
Comment
Question by:minjiezen
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16990138
there is a function (probably QImage::setNumColors(int)) which write to an address which is invalid, either 'cause it gets a wrong pointer to it, or 'cause the data written was to large.
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 50 total points
ID: 16990680
You have trashed the arena (i.e. you have written off the end or start of an area of memory obtained with calloc / malloc. Or you may ahve called free() on a poiter that was not obtained from the first 2 functions. Or written to memory after it was freed.
The problem is quite likely not with the library - programs can often carry on for a while after the arena has been corrupted.
Problems like this can be a little awkward to find - there are free tools like Electric Fence http://freshmeat.net/redir/efence/2277/url_homepage/efence.php or I myself use the memory debug package from tcl - but that requires one to recompile everything. There are non-free tools too, like IBM/Rational (it's very good).
0
 

Author Comment

by:minjiezen
ID: 16995201
Hello guys, thank you very much for your info!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux rpm install 5 219
shell script help 1 148
read a word from a file in linux shell script 4 78
BASH script to modify crontab? 3 69
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question