in case of very big input files your application 'eats' all the memory. It's better to write to the file just application recieves a message. use boost::shared_ptr< std::ostream > instead of std::vector< binary_reader::stock_data >