<code>std::cout << "addr = " << addr << std::endl << std::flush;</code> disagrees with you.