thanks, I forgot to set up storage capacity for some a vector before using [] operator on it. thanks
> Subject: Re: [OMPI users] OMPI seg fault by a class with weird address. > From: jsquy...@cisco.com > Date: Wed, 16 Mar 2011 20:20:20 -0400 > CC: us...@open-mpi.org > To: dtustud...@hotmail.com > > Make sure you have the latest version of valgrind. > > But it definitely does highlight what could be real problems if you read down > far enough in the output. > > > ==18729== Invalid write of size 8 > > ==18729== at 0x443BEF: initPopPara(population*, > > std::vector<message_para_to_workersT, > > std::allocator<message_para_to_workersT> >&, initParaType&, int, int, > > std::vector<double, std::allocator<double> >&) (main-parallel2.cpp:552) > > ==18729== by 0x44F12E: main (main-parallel2.cpp:204) > > ==18729== Address 0x62c9da0 is 0 bytes after a block of size 0 alloc'd > > ==18729== at 0x4A0666E: operator new(unsigned long) > > (vg_replace_malloc.c:220) > > ==18729== by 0x4573E4: void > > std::__uninitialized_fill_n_aux<message_para_to_workersT*, unsigned long, > > message_para_to_workersT>(message_para_to_workersT*, unsigned long, > > message_para_to_workersT const&, __false_type) (new_allocator.h:88) > > ==18729== by 0x4576CF: void > > std::__uninitialized_fill_n_a<message_para_to_workersT*, unsigned long, > > message_para_to_workersT, > > message_para_to_workersT>(message_para_to_workersT*, unsigned long, > > message_para_to_workersT const&, std::allocator<message_para_to_workersT>) > > (stl_uninitialized.h:218) > > ==18729== by 0x44EE2E: main (stl_vector.h:218) > > The above is an invalid read of write of size 8 -- you're essentially writing > outside of an array. > > Valgrind is showing you the call stack to how it got there. Looks like you > new'ed or malloc'ed a block of size 0 and then tried to write something to > it. Writing to memory that you don't own is a no-no; it can cause Very Bad > Things to happen. > > You should probably investigate this, and the other issues that it is > reporting (e.g., the next invalid read of size 8). > > > ==18729== > > ==18729== Invalid read of size 8 > > ==18729== at 0x44F13A: main (main-parallel2.cpp:208) > > ==18729== Address 0x62c9d60 is 0 bytes after a block of size 0 alloc'd > > ==18729== at 0x4A0666E: operator new(unsigned long) > > (vg_replace_malloc.c:220) > > ==18729== by 0x45733D: void > > std::__uninitialized_fill_n_aux<message_para_to_workersT*, unsigned long, > > message_para_to_workersT>(message_para_to_workersT*, unsigned long, > > message_para_to_workersT const&, __false_type) (new_allocator.h:88) > > ==18729== by 0x4576CF: void > > std::__uninitialized_fill_n_a<message_para_to_workersT*, unsigned long, > > message_para_to_workersT, > > message_para_to_workersT>(message_para_to_workersT*, unsigned long, > > message_para_to_workersT const&, std::allocator<message_para_to_workersT>) > > (stl_uninitialized.h:218) > > ==18729== by 0x44EE2E: main (stl_vector.h:218) > > ==18729== > > > > valgrind: m_mallocfree.c:225 (mk_plain_bszB): Assertion 'bszB != 0' failed. > > valgrind: This is probably caused by your program erroneously writing past > > the > > end of a heap block and corrupting heap metadata. If you fix any > > invalid writes reported by Memcheck, this assertion failure will > > > > probably go away. Please try that before reporting this as a bug. > > > > ==18729== at 0x38029D5C: report_and_quit (m_libcassert.c:145) > > ==18729== by 0x3802A032: vgPlain_assert_fail (m_libcassert.c:217) > > ==18729== by 0x38035645: vgPlain_arena_malloc (m_mallocfree.c:225) > > ==18729== by 0x38002BB5: vgMemCheck_new_block (mc_malloc_wrappers.c:199) > > ==18729== by 0x38002F6B: vgMemCheck___builtin_new > > (mc_malloc_wrappers.c:246) > > ==18729== by 0x3806070C: do_client_request (scheduler.c:1362) > > ==18729== by 0x38061D30: vgPlain_scheduler (scheduler.c:1061) > > ==18729== by 0x38085E6E: run_a_thread_NORETURN (syswrap-linux.c:91) > > > > sched status: > > running_tid=1 > > > > Thread 1: status = VgTs_Runnable > > ==18729== at 0x4A0666E: operator new(unsigned long) > > (vg_replace_malloc.c:220) > > ==18729== by 0x464506: __gnu_cxx::new_allocator<int>::allocate(unsigned > > long, void const*) (new_allocator.h:88) > > ==18729== by 0x46452E: std::_Vector_base<int, std::allocator<int> > > >::_M_allocate(unsigned long) (stl_vector.h:127) > > ==18729== by 0x464560: std::_Vector_base<int, std::allocator<int> > > >::_Vector_base(unsigned long, std::allocator<int> const&) > > (stl_vector.h:113) > > ==18729== by 0x464B6A: std::vector<int, std::allocator<int> > > >::vector(unsigned long, int const&, std::allocator<int> const&) > > (stl_vector.h:216) > > ==18729== by 0x488F62: Index::Index() (index.cpp:20) > > ==18729== by 0x489147: ReadFile(char const*) (index.cpp:86) > > ==18729== by 0x48941C: ImportIndices() (index.cpp:121) > > ==18729== by 0x445D00: myNeplanTaskScheduler(CNSGA2*, int, int, int, > > population*, char, int, std::vector<message_para_to_workersT, > > std::allocator<message_para_to_workersT> >&, ompi_datatype_t*, int&, int&, > > std::vector<std::vector<double, std::allocator<double> >, > > std::allocator<std::vector<double, std::allocator<double> > > >&, > > std::vector<std::vector<double, std::allocator<double> >, > > std::allocator<std::vector<double, std::allocator<double> > > >&, > > std::vector<double, std::allocator<double> >&, int, > > std::vector<std::vector<double, std::allocator<double> >, > > std::allocator<std::vector<double, std::allocator<double> > > >&, > > ompi_datatype_t*, int, ompi_datatype_t*, int) (myNetplanScheduler.cpp:109) > > ==18729== by 0x44F2DF: main (main-parallel2.cpp:216) > > -- > Jeff Squyres > jsquy...@cisco.com > For corporate legal information go to: > http://www.cisco.com/web/about/doing_business/legal/cri/ >