![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 'memory corruption' error when using Awk | kooyee | UNIX for Dummies Questions & Answers | 5 | 07-09-2009 12:36 PM |
| OS is not detected CPU and memory | arumsun | SUN Solaris | 1 | 06-29-2009 05:15 AM |
| Pointer to a struct (with pointers) *** glibc detected *** double free | jatoo | High Level Programming | 1 | 12-05-2008 08:31 AM |
| *** glibc detected *** double free or corruption: 0x40236ff4 *** | norsk hedensk | High Level Programming | 19 | 11-14-2008 01:43 PM |
| *** glibc detected *** free(): invalid next size (normal): 0x0000000000503e70 *** | vbreddy | High Level Programming | 1 | 04-11-2006 12:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Why does this occur? *** glibc detected *** malloc(): memory corruption: 0x10013ff8 ***
there seems not to be error in this segment. In some computers, it can work well. But in others, it will give a failure.
why it ocurrs and how to deal with it? in a function: Code:
if( *ver == NULL ) {
*ver = (vertex *) malloc(sizeof(vertex)); //this line
if( *ver == NULL ) {
printf("memory allocation error\n");
}
}
Last edited by pludi; 3 Weeks Ago at 08:15 AM.. Reason: code tags, please |
|
||||
|
Linux 3.2.3-59
Code:
struct vertex {
int id;
int seq;
int pos;
int clique;
int numOfVer;
int numOfPrev;
int numOfNext;
int *prev;
int *next;
vertex *front;
vertex *back;
vertex *left;
vertex *right;
};
static void make_vertex(vertex **ver, int index, int s, int ps) {
*ver = NULL;
if( *ver == NULL ) {
*ver = (vertex *) malloc(sizeof(vertex));
if( *ver == NULL ) {
printf("memory allocation error\n");
exit(1);
}
}
(*ver)->id = index;
(*ver)->seq = s;
(*ver)->pos = ps;
(*ver)->clique = 0;
(*ver)->numOfPrev = 0;
(*ver)->numOfVer = 0;
(*ver)->numOfNext = 0;
(*ver)->prev = NULL;
(*ver)->next = NULL;
(*ver)->front = NULL;
(*ver)->back = NULL;
(*ver)->left = NULL;
(*ver)->right = NULL;
}
Last edited by cdbug; 3 Weeks Ago at 11:55 AM.. |
|
||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|