I'm getting this error at the end of my program...

*** glibc detected *** ./a.out: free(): invalid pointer: 0x00617ca0 ***
======= Backtrace: =========
/lib/libc.so.6[0x684ac1]
/lib/libc.so.6(cfree+0x90)[0x6880f0]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xc986f1]
./a.out[0x804ce2f]
./a.out[0x804973d]
/lib/libc.so.6(__libc_start_main+0xe0)[0x631390]
./a.out(__gxx_personality_v0+0x7d)[0x8048de1]
======= Memory map: ========
00110000-00111000 r-xp 00110000 00:00 0          [vdso]
005fc000-00617000 r-xp 00000000 08:01 687043     /lib/ld-2.7.so
00617000-00618000 r-xp 0001a000 08:01 687043     /lib/ld-2.7.so
00618000-00619000 rwxp 0001b000 08:01 687043     /lib/ld-2.7.so
0061b000-0076e000 r-xp 00000000 08:01 687044     /lib/libc-2.7.so
0076e000-00770000 r-xp 00153000 08:01 687044     /lib/libc-2.7.so
00770000-00771000 rwxp 00155000 08:01 687044     /lib/libc-2.7.so
00771000-00774000 rwxp 00771000 00:00 0 
00776000-0079d000 r-xp 00000000 08:01 687049     /lib/libm-2.7.so
0079d000-0079e000 r-xp 00026000 08:01 687049     /lib/libm-2.7.so
0079e000-0079f000 rwxp 00027000 08:01 687049     /lib/libm-2.7.so
00b70000-00b7b000 r-xp 00000000 08:01 687059     /lib/libgcc_s-4.1.2-20070925.so.1
00b7b000-00b7c000 rwxp 0000a000 08:01 687059     /lib/libgcc_s-4.1.2-20070925.so.1
00be5000-00cc5000 r-xp 00000000 08:03 1564840    /usr/lib/libstdc++.so.6.0.8
00cc5000-00cc9000 r-xp 000df000 08:03 1564840    /usr/lib/libstdc++.so.6.0.8
00cc9000-00cca000 rwxp 000e3000 08:03 1564840    /usr/lib/libstdc++.so.6.0.8
00cca000-00cd0000 rwxp 00cca000 00:00 0 
08048000-0804f000 r-xp 00000000 08:05 2505943    /data/a.out
0804f000-08050000 rw-p 00006000 08:05 2505943    /data/a.out
081c1000-081e2000 rw-p 081c1000 00:00 0 
b7e00000-b7e21000 rw-p b7e00000 00:00 0 
b7e21000-b7f00000 ---p b7e21000 00:00 0 
b7f76000-b7f78000 rw-p b7f76000 00:00 0 
b7f8f000-b7f90000 rw-p b7f8f000 00:00 0 
bffa9000-bffbe000 rw-p bffea000 00:00 0          [stack]
Aborted

what exactly does this mean?

edit: I tried commenting out my destructors(I'm not freeing memory elsewhere)..still gives the same error

Recommended Answers

Probably that you're trying to free() memory that you didn't allocate (malloc)

Jump to Post

You could post the code so we can have a look?

Jump to Post

All 6 Replies

Probably that you're trying to free() memory that you didn't allocate (malloc)

I only use new and delete and Im not freeing anywhere else except my destructors...which I commented and I still get the error...what other possibilities exist?

You could post the code so we can have a look?

Its solved...it had to do with a declaration..thanks

Its solved...it had to do with a declaration..thanks

i have the same exact problem. what do you mean by the problem being a declaration? i have a function that returns an array. int* getNum() { return num1} and num1 is an array. and i have another integer array. int* num2. num2 = new int. num2 = ln.getNum(). (ln is an object that is irrelevant). any help would be appreciated. thanks in advance!

commented: Post your code, and ask your question in a NEW THREAD -4

Its solved...it had to do with a declaration..thanks

What was the solution ?? Can you post it here ?

commented: Post your code, and ask your question in a NEW THREAD -4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.