C++ - rapidxml crashes program during parse, only as release program

Discussion in 'XML Forums' started by coffeecat, Apr 10, 2013.

  1. coffeecat

    coffeecat New Member

    My program only crashes in Release mode without a debugger, and my program returns status 3 (I'm not sure if that is important), when trying to parse with rapidxml. It is not a memory leak (at least, not written by me).This code crashes the program:\[code\]std::vector<char> vec = m_push_map_vector(m_filedata);rapidxml::xml_document<> doc;doc.clear();doc.parse<rapidxml::parse_full>(&vec[0]);\[/code\]The vector creating code is:\[code\]std::vector<char> TMXParser::m_push_map_vector(const std::string data){ std::vector<char> vec; vec.clear(); vec.reserve(vec.size() + data.size()); std::copy(data.begin(), data.end(), std::back_inserter(vec)); vec.push_back('\0'); vec.shrink_to_fit(); return vec;}\[/code\]Debug works perfectly as expected. I'm not sure what's wrong. Any ideas?I'm using MinGW 4.7.0 in Codeblocks.

Share This Page