473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

***glibc detected*** free(): invalid next size (fast): help?

I made a program that finds a minimum spanning tree.

In my main
I created
kruskal k;
and called
k.findMST();

Expand|Select|Wrap|Line Numbers
  1. void kruskal :: findMST(){
  2. int edgesAccepted = 0;
  3. disjoint ds( numVer ); //disjoint set data structure
  4. edge e; //struct containing vertices and weight
  5. int u,v;
  6.  
  7. while( ( edgesAccepted < numVer - 1 ) && !que.empty())
  8. {
  9. //finds mst 
  10. }
  11.  
  12. }
  13.  
After findMST() function ends, i get the following error.



Expand|Select|Wrap|Line Numbers
  1. *** glibc detected *** ./prog2: free(): invalid next size (fast): 0x09de8180 ***
  2. ======= Backtrace: =========
  3. /lib/libc.so.6[0xb36a96]
  4. /lib/libc.so.6(cfree+0x90)[0xb39fb0]
  5. /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x342a691]
  6. ./prog2[0x804bb15]
  7. ./prog2[0x804bb3f]
  8. ./prog2[0x804bb78]
  9. ./prog2[0x804bc56]
  10. ./prog2[0x804b67b]
  11. ./prog2[0x8049b50]
  12. ./prog2[0x8049565]
  13. /lib/libc.so.6(__libc_start_main+0xdc)[0xae5dec]
  14. ./prog2(__gxx_personality_v0+0x65)[0x8048e91]
  15. ======= Memory map: ========
  16. 00ab3000-00acc000 r-xp 00000000 08:02 196887     /lib/ld-2.5.so
  17. 00acc000-00acd000 r-xp 00019000 08:02 196887     /lib/ld-2.5.so
  18. 00acd000-00ace000 rwxp 0001a000 08:02 196887     /lib/ld-2.5.so
  19. 00ad0000-00c0a000 r-xp 00000000 08:02 196888     /lib/libc-2.5.so
  20. 00c0a000-00c0c000 r-xp 0013a000 08:02 196888     /lib/libc-2.5.so
  21. 00c0c000-00c0d000 rwxp 0013c000 08:02 196888     /lib/libc-2.5.so
  22. 00c0d000-00c10000 rwxp 00c0d000 00:00 0
  23. 00c12000-00c37000 r-xp 00000000 08:02 196958     /lib/libm-2.5.so
  24. 00c37000-00c38000 r-xp 00024000 08:02 196958     /lib/libm-2.5.so
  25. 00c38000-00c39000 rwxp 00025000 08:02 196958     /lib/libm-2.5.so
  26. 0335e000-03369000 r-xp 00000000 08:02 197036     /lib/libgcc_s-4.1.2-20070626.so.1
  27. 03369000-0336a000 rwxp 0000a000 08:02 197036     /lib/libgcc_s-4.1.2-20070626.so.1
  28. 03377000-03457000 r-xp 00000000 08:02 1167049    /usr/lib/libstdc++.so.6.0.8
  29. 03457000-0345b000 r-xp 000df000 08:02 1167049    /usr/lib/libstdc++.so.6.0.8
  30. 0345b000-0345c000 rwxp 000e3000 08:02 1167049    /usr/lib/libstdc++.so.6.0.8
  31. 0345c000-03462000 rwxp 0345c000 00:00 0
  32. 08048000-0804d000 r-xp 00000000 00:1b 31195548   /prog2
  33. 0804d000-0804e000 rwxp 00004000 00:1b 31195548  /prog2
  34. 09de8000-09e09000 rwxp 09de8000 00:00 0
  35. 40000000-40001000 r-xp 40000000 00:00 0          [vdso]
  36. 40001000-4000a000 rw-p 40001000 00:00 0
  37. 4001a000-4001c000 rw-p 4001a000 00:00 0
  38. 40100000-40121000 rw-p 40100000 00:00 0
  39. 40121000-40200000 ---p 40121000 00:00 0
  40. bfd64000-bfd7a000 rw-p bfd64000 00:00 0          [stack]
  41. make: *** [run] Aborted
  42.  
Nov 29 '07 #1
1 19349
RRick
463 Expert 256MB
These messages generally mean that the heap storage (i.e. malloc) has been corrupted.

Unfortunately, you won't get much information from the stack dump as to who or what caused this problem. Heap corruption is usually caused by a rogue pointer or buffer overwrite and shows up later in the program execution after the damage has been done.

Valgrind is a good memory checker for these types of problems.
Dec 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rob | last post by:
Hi I am getting the error *** glibc detected *** free(): invalid pointer: 0x083e20cc *** Aborted When I run the code <?php
27
by: Deephay | last post by:
Greetings all, I have a program that used the realloc() function to change the allocated size of a buffer, the program works with some arguments, but with some other arguments, it will show me...
1
by: mahiapkum | last post by:
hello all i have a code which looks fine when reviewed but when the application has a long run say for example of 2 days it gets exit, because of glibc error and the sample code is as follows: while...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
4
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
3
by: Renzr | last post by:
I have a C++ package which works very well in the 32-bit Linux-like OS. However, it will lead to a "*** glibc detected *** ./ex2: munmap_chunk(): invalid pointer" in 64-bit (Fedora 7-64), when it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.