I am using valgrind to test, and I get this output (this is an MPI process running on a supercomputer)
Code:
==22894== Conditional jump or move depends on uninitialised value(s)
==22894== at 0x413E29: std::_Rb_tree<int, std::pair<int const, _tx_info_server*>, std::_Select1st<std::pair<int const, _tx_info_server*> >, std::less<int>, std::allocator<std::pair<int const, _tx_info_server*> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<int const, _tx_info_server*> const&) (in /gscratch2/jdayal/txserver)
==22894== by 0x414284: std::_Rb_tree<int, std::pair<int const, _tx_info_server*>, std::_Select1st<std::pair<int const, _tx_info_server*> >, std::less<int>, std::allocator<std::pair<int const, _tx_info_server*> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<int const, _tx_info_server*> >, std::pair<int const, _tx_info_server*> const&) (in /gscratch2/jdayal/txserver)
==22894== by 0x414649: std::map<int, _tx_info_server*, std::less<int>, std::allocator<std::pair<int const, _tx_info_server*> >>::insert(std::_Rb_tree_iterator<std::pair<int const, _tx_info_server*> >, std::pair<int const, _tx_info_server*> const&) (in /gscratch2/jdayal/txserver)
==22894== by 0x4146F0: std::map<int, _tx_info_server*, std::less<int>, std::allocator<std::pair<int const, _tx_info_server*> > >::operator[](int const&) (in /gscratch2/jdayal/txserver)
==22894== by 0x40CC29: mpi_process_transaction(mpi_tx*, ompi_status_public_t*, MSG_TAG) (in /gscratch2/jdayal/txserver)
==22894== by 0x40CFC3: make_progress(bool) (in /gscratch2/jdayal/txserver)
==22894== by 0x434F17: nssi_service_start (in /gscratch2/jdayal/txserver)
==22894== by 0x40E46C: main (in /gscratch2/jdayal/txserver)
==22894== Uninitialised value was created by a stack allocation
==22894== at 0x41464C: std::map<int, _tx_info_server*, std::less<int>, std::allocator<std::pair<int const, _tx_info_server*> > >::operator[](int const&) (in /gscratch2/jdayal/txserver)
It looks like the problem is me calling the map in the function mpi_process_transaction.
These functions, and the map, are declared in my tx_server.cpp file (which is what contains the main for txserver).
At the top of this file, I create the map this way:
Code:
map<int, tx_info_server*> current_tx_map;
Then, I use it accordingly (this is in the function mpi_process_transaction):
Code:
tx_info_server * info = new tx_info_server(tx->tx_id);
current_tx_map[info->tx_id] = info;
Any idea as to what I'm doing wrong?
I should note, that if I don't use valgrind, it crashes. If I do use valgrind, it throws some errors, like above, but continues with its normal operation!