CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Aug 2006
    Posts
    14

    Porting from VC6 to Linux Fedora core 5 problem

    Hi, I'm a new member in the forum. I have quite a problem here. Actually, I've posted it in www.cprogramming.com, but since I needed it to be resolved fast, I post it here also.

    Recently, I ported my codes from Visual C 6 to Linux. But, what I meant about porting was only copy-pasted the entire code to a new KDevelop C/C++ project (also a little letter-case correction in the #include line ). The code was successfully compiled and built. But when I run it, there's a memory corruption error. I don' tknow what's wrong with it because it never happened before in VC6. The error was in the "myVector.push_back(mObject) ". And the myVector declaration was "vector<*MyObject> myVector". The strange thing was not all of the push_back methods was faulty. Only a few of them. And it gets more strange because when I moved the faulty method to the beginning of the function, it worked fine until the next push_back method. Here's the error message:

    *** glibc detected *** ./mattinggame: malloc(): memory corruption:
    0x09f67f70 ***


    *
    ======= Backtrace: =========
    /lib/libc.so.6[0xb49660]
    /lib/libc.so.6(malloc+0x74)[0xb4ac7c]
    /usr/lib/libstdc++.so.6(_Znwj+0x27)[0x220e4d7]
    /usr/lib/libstdc++.so.6(_Znaj+0x1d)[0x220e60d]
    ./mattinggame[0x8056536]
    ./mattinggame[0x80567bb]
    ./mattinggame[0x80578c5]
    ./mattinggame[0x8057cb2]
    ./mattinggame[0x8057dd8]
    ./mattinggame[0x8052b49]
    ./mattinggame[0x807364c]
    ./mattinggame[0x807a5ff]
    ./mattinggame(__gxx_personality_v0+0x1de)[0x80499c2]
    /lib/libc.so.6(__libc_start_main+0xdc)[0xafa7e4]
    ./mattinggame(__gxx_personality_v0+0x9d)[0x8049881]
    ======= Memory map: ========
    001bb000-001be000 r-xp 00000000 fd:00 92170 /usr/lib/libXrandr.so.2.0.0
    001be000-001bf000 rwxp 00002000 fd:00 92170 /usr/lib/libXrandr.so.2.0.0
    001dd000-001e8000 r-xp 00000000 fd:00 3457623
    /lib/libgcc_s-4.1.0-20060304.so.1
    001e8000-001e9000 rwxp 0000a000 fd:00 3457623
    /lib/libgcc_s-4.1.0-20060304.so.1
    00215000-00216000 r-xp 00215000 00:00 0 [vdso]
    00258000-00271000 r-xp 00000000 fd:00 3457612 /lib/ld-2.4.so
    00271000-00272000 r-xp 00018000 fd:00 3457612 /lib/ld-2.4.so
    00272000-00273000 rwxp 00019000 fd:00 3457612 /lib/ld-2.4.so
    00548000-00592000 r-xp 00000000 fd:00 75310
    /usr/local/lib/libSDL_mixer-1.2.so.0.2.5
    00592000-0059c000 rwxp 0004a000 fd:00 75310
    /usr/local/lib/libSDL_mixer-1.2.so.0.2.5
    0059c000-005c0000 rwxp 0059c000 00:00 0
    00680000-006e3000 r-xp 00000000 fd:00 71301
    /usr/local/lib/libSDL-1.2.so.0.11.0
    006e3000-006e5000 rwxp 00063000 fd:00 71301
    /usr/local/lib/libSDL-1.2.so.0.11.0
    006e5000-00700000 rwxp 006e5000 00:00 0
    00ae5000-00c11000 r-xp 00000000 fd:00 3457618 /lib/libc-2.4.so
    00c11000-00c14000 r-xp 0012b000 fd:00 3457618 /lib/libc-2.4.so
    00c14000-00c15000 rwxp 0012e000 fd:00 3457618 /lib/libc-2.4.so
    00c15000-00c18000 rwxp 00c15000 00:00 0
    00c1a000-00c3d000 r-xp 00000000 fd:00 3457619 /lib/libm-2.4.so
    00c3d000-00c3e000 r-xp 00022000 fd:00 3457619 /lib/libm-2.4.so
    00c3e000-00c3f000 rwxp 00023000 fd:00 3457619 /lib/libm-2.4.so
    00c41000-00c43000 r-xp 00000000 fd:00 3457620 /lib/libdl-2.4.so
    00c43000-00c44000 r-xp 00001000 fd:00 3457620 /lib/libdl-2.4.so
    00c44000-00c45000 rwxp 00002000 fd:00 3457620 /lib/libdl-2.4.so
    00c47000-00d40000 r-xp 00000000 fd:00 92167 /usr/lib/libX11.so.6.2.0
    00d40000-00d44000 rwxp 000f9000 fd:00 92167 /usr/lib/libX11.so.6.2.0
    00d46000-00d48000 r-xp 00000000 fd:00 92165 /usr/lib/libXau.so.6.0.0
    00d48000-00d49000 rwxp 00001000 fd:00 92165 /usr/lib/libXau.so.6.0.0
    00d60000-00d65000 r-xp 00000000 fd:00 92166 /usr/lib/libXdmcp.so.6.0.0
    00d65000-00d66000 rwxp 00004000 fd:00 92166 /usr/lib/libXdmcp.so.6.0.0
    00d68000-00d77000 r-xp 00000000 fd:00 92169 /usr/lib/libXext.so.6.4.0
    00d77000-00d78000 rwxp 0000e000 fd:00 92169 /usr/lib/libXext.so.6.4.0
    00dc7000-00dcf000 r-xp 00000000 fd:00 92168 /usr/lib/libXrender.so.1.3.0
    00dcf000-00dd0000 rwxp 00007000 fd:00 92168 /usr/lib/libXrender.so.1.3.0
    00dd2000-00de2000 r-xp 00000000 fd:00 3457622 /lib/libpthread-2.4.so
    00de2000-00de3000 r-xp 0000f000 fd:00 3457622 /lib/libpthread-2.4.so
    00de3000-00de4000 rwxp 00010000 fd:00 3457622 /lib/libpthread-2.4.so
    00de4000-00de6000 rwxp 00de4000 00:00 0
    00de8000-00df1000 r-xp 00000000 fd:00 92172 /usr/lib/libXcursor.so.1.0.2
    00df1000-00df2000 rwxp 00008000 fd:00 92172 /usr/lib/libXcursor.so.1.0.2
    00df4000-00df8000 r-xp 00000000 fd:00 92171 /usr/lib/libXfixes.so.3.0.0
    00df8000-00df9000 rwxp 00003000 fd:00 92171 /usr/lib/libXfixes.so.3.0.0
    02157000-02239000 r-xp 00000000 fd:00 92179 /usr/lib/libstdc++.so.6.0.8
    02239000-0223d000 r-xp 000e2000 fd:00 92179 /usr/lib/libstdc++.so.6.0.8
    0223d000-0223e000 rwxp 000e6000 fd:00 92179 /usr/lib/libstdc++.so.6.0.8
    0223e000-02244000 rwxp 0223e000 00:00 0
    08048000-08087000 r-xp 00000000 fd:00 1533373
    /home/benang/mattinggame/debug/src/mattinggame
    08087000-08088000 rw-p 0003e000 fd:00 1533373
    /home/benang/mattinggame/debug/src/mattinggame
    098e0000-09d85000 rw-p 098e0000 00:00 0 [heap]
    b4a00000-b4a21000 rw-p b4a00000 00:00 0
    b4a21000-b4b00000 ---p b4a21000 00:00 0
    b4b2d000-b6a5d000 rw-p b4b2d000 00:00 0
    b6a5d000-b6b89000 rw-s 00000000 00:08 3112963 /SYSV00000000 (deleted)
    b6b89000-b6b8a000 ---p b6b89000 00:00 0
    b6b8a000-b758a000 rw-p b6b8a000 00:00 0
    b758a000-b758b000 ---p b758a000 00:00 0
    b758b000-b7f8e000 rw-p b758b000 00:00 0
    b7fa6000-b7fa9000 rw-p b7fa6000 00:00 0
    bff93000-bffa9000 rw-p bff93000 00:00 0 [stack]
    /bin/sh: line 1: 27410 Aborted ./mattinggame

    BTW, I've changed the code into MyObject **mObject and the object was created by :"mObject = new MyObject[mCount]". It worked fine until a while. When I uncommented a large part of the code, it gone berserk again.

    Can anybody help me here?? I'm desperate to a suicidal point here (well, maybe suicidal is a bit too much, but it sure give me a nightmare). Thanks in advance.
    Last edited by g4j31a5; August 3rd, 2006 at 06:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured