Subj : Problems with delete/free To : borland.public.cpp.borlandcpp From : "Rob C. " Date : Mon Oct 27 2003 12:50 pm This is very strange. I wrote a program to test new/delete - malloc/free functions. Both sets worked fine as long as I “compiled” the program as a single module. When I built them as a project, however, free and delete wouldn’t do anything . . . no errors or warnings or anything, but they just wouldn’t do anything. I tried all the platforms, but still they just wouldn’t do anything. What’s going on? --------------------------------------------------- /* free example */ #include #include #include #include #include int main(void) { char *str; int sub; char *myarray[10]= {'\0'}; char *str1, *str2, *str4, *str3, *str5; char line[30], line2[30], line3[30], line4[30], line5[30]; clrscr(); /* allocate memory for string */ str = (char *) malloc(10); /* copy "Hello" to string */ strcpy(str, "Hello"); /* display string */ printf("String is %s\n", str); /* free memory */ free(str); printf("String is %s\n", str); //----------------------------- str1 = new char(30); //(char *) malloc(30); strcpy( str1, "linenumber2" ); printf( "1) %s \r\n" , str1 ); delete str1; //free(str1); printf( "1) %s \r\n" , str1 ); return 0; } .