I am using Mandriva Linux (2.6.17-14) with gnu g++ version 4.1.2. The source code used to test is given below. When i am run the program, it is properly freeing up the allocated memory. When also including the lines that are commented in the code, the "delete" is not freeing up the memory used. I do not have the problem when compiling under cygwin. What can be done to fix this?
Source Code: #include <stdio.h> #include <stdlib.h> #include <string.h> struct node { char *value; char temp[5000]; node *right; } *head; int main() { int i; node* tmp; tmp=NULL; for (i=0;i<10000;i++) { head=new node; // head->value = NULL; // head->value = new char; // *(head->value)='C'; head->right=tmp; tmp=head; } do { tmp=head->right; // delete (head->value); // head->value=NULL; delete head; head=tmp; } while (head!=NULL); printf("OK!\n"); for (;;); } _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus