LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-22-2011, 11:08 PM   #1
Jae-Yong Yoo
LQ Newbie
 
Registered: Jul 2011
Posts: 20

Rep: Reputation: Disabled
A general question regarding memory errors in g++


Hi,


I have a general question regarding memory errors.
I frequently ran into memory errors such as seg fault, double free, etc.
Sometimes I got the following traces for example.


*** glibc detected *** /mnt/click: free(): invalid pointer: 0xb7ed8450 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7dff905]
/lib/libc.so.6[0xb7e011a3]
/lib/libc.so.6(cfree+0x6d)[0xb7e0422d]
/mnt/click(_Z13ofpbuf_deleteP6ofpbuf+0x16)[0x8157686]
/mnt/click[0x815f750]
/mnt/click[0x81616f4]
/mnt/click[0x815940d]
/mnt/click(_Z10rconn_sendP5rconnP6ofpbufPi+0xc9)[0x8159529]
/mnt/click(_Z21rconn_send_with_limitP5rconnP6ofpbufPii+0x6b)[0x815959b]
/mnt/click[0x81491ed]
/mnt/click(_ZN8Datapath20send_openflow_bufferEP6ofpbufPK12rconn_sender+0x42)[0x814b582]
/mnt/click(_ZN8Datapath22dp_send_features_replyEPK12rconn_sender+0x1a2)[0x814e432]
/mnt/click(_ZN8Datapath17fwd_control_inputEP6Packet+0x264)[0x814e6c4]
/mnt/click(_ZN8Datapath4pushEiP6Packet+0x2ff)[0x814ea1f]
/mnt/click(_ZN5RConn29send_control_packets_to_clickEv+0x91)[0x8149021]
/mnt/click(_ZN5RConn9run_timerEP5Timer+0x3d)[0x8149a6d]
/mnt/click(_ZN8TimerSet10run_timersEP12RouterThreadP6Master+0x1dd)[0x825577d]
/mnt/click(_ZN12RouterThread6driverEv+0x29a)[0x8248a3a]
/mnt/click(main+0x86e/lib/libc.so.6(__libc_start_main+0xe5)[0xb7daab55]
/mnt/click[0x80c0481]
======= Memory map: ========
08048000-08318000 r-xp 00000000 00:12 655498 /mnt/click
08318000-08319000 r-xp 002cf000 00:12 655498 /mnt/click
08319000-0831a000 rwxp 002d0000 00:12 655498 /mnt/click
0831a000-08340000 rwxp 0831a000 00:00 0 [heap]
b7300000-b7321000 rwxp b7300000 00:00 0
b7321000-b7400000 ---p b7321000 00:00 0
b74d6000-b7558000 rwxp b74d6000 00:00 0
b7558000-b7559000 ---p b7558000 00:00 0
b7559000-b7d7c000 rwxp b7559000 00:00 0
b7d7c000-b7d90000 r-xp 00000000 08:01 96673 /lib/libpthread-2.10.2.so
b7d90000-b7d91000 r-xp 00013000 08:01 96673 /lib/libpthread-2.10.2.so
b7d91000-b7d92000 rwxp 00014000 08:01 96673 /lib/libpthread-2.10.2.so
b7d92000-b7d94000 rwxp b7d92000 00:00 0
b7d94000-b7ed5000 r-xp 00000000 08:01 96525 /lib/libc-2.10.2.so
b7ed5000-b7ed7000 r-xp 00141000 08:01 96525 /lib/libc-2.10.2.so
b7ed7000-b7ed8000 rwxp 00143000 08:01 96525 /lib/libc-2.10.2.so
b7ed8000-b7edb000 rwxp b7ed8000 00:00 0
b7edb000-b7ee7000 r-xp 00000000 08:01 96356 /lib/libgcc_s.so.1
b7ee7000-b7ee8000 rwxp 0000b000 08:01 96356 /lib/libgcc_s.so.1
b7ee8000-b7f0c000 r-xp 00000000 08:01 96521 /lib/libm-2.10.2.so
b7f0c000-b7f0d000 r-xp 00023000 08:01 96521 /lib/libm-2.10.2.so
b7f0d000-b7f0e000 rwxp 00024000 08:01 96521 /lib/libm-2.10.2.so
b7f0e000-b7ff4000 r-xp 00000000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff4000-b7ff8000 r-xp 000e6000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff8000-b7ff9000 rwxp 000ea000 08:01 35291 /usr/local/harpoon/plugins/libstdc++.so.6.0.13
b7ff9000-b8000000 rwxp b7ff9000 00:00 0
b8000000-b8007000 r-xp 00000000 08:01 96349 /lib/librt-2.10.2.so
b8007000-b8008000 r-xp 00006000 08:01 96349 /lib/librt-2.10.2.so
b8008000-b8009000 rwxp 00007000 08:01 96349 /lib/librt-2.10.2.so
b8009000-b800a000 rwxp b8009000 00:00 0
b800a000-b800c000 r-xp 00000000 08:01 96675 /lib/libdl-2.10.2.so
b800c000-b800d000 r-xp 00001000 08:01 96675 /lib/libdl-2.10.2.so
b800d000-b800e000 rwxp 00002000 08:01 96675 /lib/libdl-2.10.2.so
b800e000-b8036000 r-xp 00000000 08:01 35154 /usr/lib/libpcap.so.0.9.8
b8036000-b8038000 rwxp 00027000 08:01 35154 /usr/lib/libpcap.so.0.9.8
b803a000-b803d000 rwxp b803a000 00:00 0
b803d000-b8059000 r-xp 00000000 08:01 96522 /lib/ld-2.10.2.so
b8059000-b805a000 r-xp 0001b000 08:01 96522 /lib/ld-2.10.2.so
b805a000-b805b000 rwxp 0001c000 08:01 96522 /lib/ld-2.10.2.so
bfb45000-bfb5a000 rw-p bffeb000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]


Then, I just run gdb, valgrind things and suddenly I started ask questions myself that what are those traces and how can I analyze?

do you guys know how to analyze or any tutorials?


wishes,
Jae-Yong
 
Old 07-24-2011, 05:42 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
It sounds like you're trying to free memory that has already been freed, or writing to memory that isn't meant to be written to. Comment out code until you get to a reasonably small section of code that reproduces the error, then post it here and we'll try to spot what's gone wrong (or, even better, try to work it out yourself based on the smaller code sample)
 
  


Reply



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
A question regarding the memory errors dongbo Linux - Embedded & Single-board computer 2 10-26-2009 04:08 AM
Memory Errors in X? userlander Linux - Desktop 1 12-10-2008 08:42 AM
Acrobat 8 out of memory errors! deathsfriend99 Linux - Software 2 10-29-2008 08:49 AM
How to simulate out of memory errors? lowpro2k3 Programming 8 10-21-2005 04:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:38 PM.

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