Saturday, July 5th 2008, 10:53pm UTC+1

You are not logged in.

  • Login
  • Register

1

Monday, May 12th 2008, 2:03pm

Segmenting while reading a file

--------------------------------------------------------------------------------
I am creating an application, where I will read data from /proc/stat file which contains cpu uasge data and plot the values of cpu usage with respect to time.

For this I am writing a Timer event which for every 1 sec it opens the file and read the data and plot.

In my application I am calling the timer event 126 times.

At the 30 th iteration of the timer event the apllication is segmenting withe following message .

/**********************************************************/

*** glibc detected *** ./cpu: malloc(): memory corruption: 0x0000000000679e90 ***
======= Backtrace: =========
/lib64/libc.so.6[0x36c4c6f0e4]
/lib64/libc.so.6(__libc_malloc+0x7d)[0x36c4c7086d]
/lib64/libc.so.6[0x36c4c5ecda]
./cpu(_ZN7QWidget11qt_propertyEiiP8QVariant+0xf06)[0x4059be]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN7QObject5eventEP6QEvent+0x66)[0x3e79
560ff6]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN7QWidget5eventEP6QEvent+0x2 [0x3e79598518]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN12QApplication14internalNotifyEP7QOb
jectP6QEvent+0x85)[0x3e795007d5]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN12QApplication6notifyEP7QObjectP6QEv
ent+0xa4)[0x3e79501ca4]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop14activateTimersEv+0x21c
)[0x3e794f5bbc]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop13processEventsEj+0x4e1)
[0x3e794af351]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop9enterLoopEv+0x41)[0x3e7
9517f91]
/usr/lib64/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop4execEv+0x22)[0x3e79517e
72]
./cpu(_ZN7QWidget5closeEb+0x253)[0x40552b]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x36c4c1da44]
./cpu(_ZN7QWidget5closeEb+0xc1)[0x405399]
======= Memory map: ========
00400000-00407000 r-xp 00000000 08:03 622657 /DEMO/cpu/cpu
00607000-00608000 rw-p 00007000 08:03 622657 /DEMO/cpu/cpu
00608000-006aa000 rw-p 00608000 00:00 0 [heap]
36c4800000-36c481a000 r-xp 00000000 08:03 98887 /lib64/ld-2.5.so
36c4a19000-36c4a1a000 r--p 00019000 08:03 98887 /lib64/ld-2.5.so
36c4a1a000-36c4a1b000 rw-p 0001a000 08:03 98887 /lib64/ld-2.5.so
36c4c00000-36c4d44000 r-xp 00000000 08:03 98888 /lib64/libc-2.5.so
36c4d44000-36c4f44000 ---p 00144000 08:03 98888 /lib64/libc-2.5.so

/*********************************************************/


From the above meesage I feel that memory corruption is happening , But how to resolve this memory corruption.

Please help me .
  • Go to the top of the page

krsmichael

Beginner

Posts: 49

Location: California

Occupation: Software Engineer

2

Monday, May 26th 2008, 7:21pm

RE: Segmenting while reading a file

--------------------------------------------------------------------------------
I am creating an application, where I will read data from /proc/stat file which contains cpu uasge data and plot the values of cpu usage with respect to time.

For this I am writing a Timer event which for every 1 sec it opens the file and read the data and plot.

In my application I am calling the timer event 126 times.

At the 30 th iteration of the timer event the apllication is segmenting withe following message .


From the above meesage I feel that memory corruption is happening , But how to resolve this memory corruption.

Please help me .
We can't help you without the source. All the dump tells me is that you died on the timer. There are any number of things that you could have done in the source that won't show in the dump.
  • Go to the top of the page

nijish

Trainee

Posts: 154

Location: Bangalore

Occupation: Software Engineer

3

Tuesday, June 3rd 2008, 5:41pm

there are innumero memory leaks tools. valgrind,...
  • Go to the top of the page

nijish

Trainee

Posts: 154

Location: Bangalore

Occupation: Software Engineer

4

Tuesday, June 3rd 2008, 5:43pm

which is the best memory leak/protection tool/algorithm in theory/use?... ;)
  • Go to the top of the page

Rate this thread