Hai Binu and others, I wud like to put my problem once more so that first time readers will undestand.The VALGRIND output of a C++ program says the following error.
**24194** new/new[] failed and should throw an exception, <refer the 2nd output of valgrind in the bottom of this message> It says new has failed, i suppose new will fail when there is not enough memory for the process or the program has encounter a memory leak already before new. So it encounters a corrupted memory during allocation.Please correct me if i am wrong.VALGRIND says there is no memory leak in my program before that new statement.So i think my system runs out of memory.but i dont think that is possible because i have 256MB ram and 1GB swap. I had attached the various outputs that valgrind gave and relavent lines of program where error has been detected by valgrind. Please help me in solving this problem. thanks regards Deepan Chakravarthy N > Various outputs of Valgrind: > > output 1:- > > Specific lines in the program: > ==17352== Invalid read of size 4 > ==17352== at 0x804AA18: writeconverged() > (ramesh-random-nov-26-0900.cpp:800) > ==17352== by 0x804B23F: main > (ramesh-random-nov-26-0900.cpp:974) > ==17352== Address 0x1BB31184 is 4 bytes before a > block of size 16 alloc'd > ==17352== at 0x1B904E35: operator new[](unsigned) > (vg_replace_malloc.c:139) > ==17352== by 0x80488B7: get_composition() > (ramesh-random-nov-26-0900.cpp:69) > ==17352== by 0x804B226: main > (ramesh-random-nov-26-0900.cpp:969) > > > output 2:- > > ==24194== Warning: silly arg (-304) to > __builtin_vec_new() > **24194** new/new[] failed and should throw an > exception, but Valgrind > cannot throw exceptions and so is aborting instead. > Sorry. > ==24194== at 0x1B8FC905: VALGRIND_PRINTF_BACKTRACE > (valgrind.h:229) > ==24194== by 0x1B904E5F: operator new[](unsigned) > (vg_replace_malloc.c:139) > ==24194== by 0x804889E: get_composition() > (ramesh-random-nov-26-0900.cpp:68) > ==24194== by 0x804B226: main > (ramesh-random-nov-26-0900.cpp:969) > > > output 3:- > > ==22630== Invalid read of size 4 > 2 ==22630== at 0x804AA18: writeconverged() > (ramesh-random-nov-26-0900.cpp:800) > 3 ==22630== by 0x804B23F: main > (ramesh-random-nov-26-0900.cpp:974) > 4 ==22630== Address 0x1BB31184 is 4 bytes > before a block of size 16 alloc'd > 5 ==22630== at 0x1B904E35: operator > new[](unsigned) (vg_replace_malloc.c:139) > 6 ==22630== by 0x80488B7: get_composition() > (ramesh-random-nov-26-0900.cpp:69) > 7 ==22630== by 0x804B226: main > (ramesh-random-nov-26-0900.cpp:969) > > > relevent lines in program: > > line no 800: > fprintf(reduced_ptr,"\t%d",newname[ptr[i2].links_div[i3][0]] > ); > > > line no 69: > > newname=new int [total_no_of_nodes]; > > line no 68: > > ptr=new struct node [total_no_of_nodes]; > ===== link to deepan's home page: http://www.geocities.com/combiofriends/deepan.html ------------------------------------------- center for biotechnology anna university chennai-25 india __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------ Yahoo! Groups Sponsor --------------------~--> $4.98 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM --------------------------------------------------------------------~-> >-----------------------------------------~-~> CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at http://www.eScribe.com/software/C-Paradise/ >------------------------------------------_-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/C-Paradise/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
