{"action":"created","issue":{"url":"https://api.github.com/repos/miloyip/rapidjson/issues/388","repository_url":"https://api.github.com/repos/miloyip/rapidjson","labels_url":"https://api.github.com/repos/miloyip/rapidjson/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/miloyip/rapidjson/issues/388/comments","events_url":"https://api.github.com/repos/miloyip/rapidjson/issues/388/events","html_url":"https://github.com/miloyip/rapidjson/issues/388","id":95686608,"number":388,"title":"Crash in Release mode on armv7 system","user":{"login":"cristianadam","id":1257414,"avatar_url":"https://avatars.githubusercontent.com/u/1257414?v=3","gravatar_id":"","url":"https://api.github.com/users/cristianadam","html_url":"https://github.com/cristianadam","followers_url":"https://api.github.com/users/cristianadam/followers","following_url":"https://api.github.com/users/cristianadam/following{/other_user}","gists_url":"https://api.github.com/users/cristianadam/gists{/gist_id}","starred_url":"https://api.github.com/users/cristianadam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristianadam/subscriptions","organizations_url":"https://api.github.com/users/cristianadam/orgs","repos_url":"https://api.github.com/users/cristianadam/repos","events_url":"https://api.github.com/users/cristianadam/events{/privacy}","received_events_url":"https://api.github.com/users/cristianadam/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-07-17T15:58:04Z","updated_at":"2016-02-08T02:08:14Z","closed_at":"2015-07-20T08:58:47Z","body":"I have the following simple code snippet:\r\n```cpp\r\nstd::string optimizeJson(const std::string& json)\r\n{\r\n    rapidjson::Document document;\r\n    if (document.Parse(json.c_str()).HasParseError())\r\n    {\r\n        std::cerr << \"Error parsing internal JSON!\" << std::endl;\r\n        abort();\r\n    }\r\n\r\n    rapidjson::StringBuffer buffer;\r\n    rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);\r\n    document.Accept(writer);\r\n\r\n    return std::string(buffer.GetString(), buffer.GetSize());\r\n}\r\n```\r\n\r\nThis snippet converts from pretty printed json into single line, no spaces json.\r\n\r\nIn debug mode the program works, in release mode it crashes with the following call stack:\r\n\r\n```\r\n0\trapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::Malloc(unsigned int)\t\t\t0x8066af2\t\r\n1\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseString<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&, bool)\t\t\t0x8066ec4\t\r\n2\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseObject<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&)\t\t\t0x8067084\t\r\n3\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseArray<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&)\t\t\t0x8067c06\t\r\n4\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseObject<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&)\t\t\t0x80670b2\t\r\n5\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseArray<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&)\t\t\t0x8067c06\t\r\n6\tvoid rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::ParseObject<0u, rapidjson::GenericStringStream<rapidjson::UTF8<char>>, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>>(rapidjson::GenericStringStream<rapidjson::UTF8<char>>&, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>&)\t\t\t0x80670b2\t\r\n7\t(anonymous namespace)::optimizeJson(std::string const&)\t\t\t0x8067688\t\r\n```\r\n\r\nThe following define is set for RapidJSON `#define RAPIDJSON_HAS_STDSTRING 1`.\r\n\r\nThe release and debug binary link to the same so files. I don't see why the code would crash as it does.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/miloyip/rapidjson/issues/comments/181161176","html_url":"https://github.com/miloyip/rapidjson/issues/388#issuecomment-181161176","issue_url":"https://api.github.com/repos/miloyip/rapidjson/issues/388","id":181161176,"user":{"login":"miloyip","id":1195774,"avatar_url":"https://avatars.githubusercontent.com/u/1195774?v=3","gravatar_id":"","url":"https://api.github.com/users/miloyip","html_url":"https://github.com/miloyip","followers_url":"https://api.github.com/users/miloyip/followers","following_url":"https://api.github.com/users/miloyip/following{/other_user}","gists_url":"https://api.github.com/users/miloyip/gists{/gist_id}","starred_url":"https://api.github.com/users/miloyip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miloyip/subscriptions","organizations_url":"https://api.github.com/users/miloyip/orgs","repos_url":"https://api.github.com/users/miloyip/repos","events_url":"https://api.github.com/users/miloyip/events{/privacy}","received_events_url":"https://api.github.com/users/miloyip/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T02:08:14Z","updated_at":"2016-02-08T02:08:14Z","body":"No need to implement. But you need to specify using `CrtAllocator` as template parameter.\r\n\r\n1. Is it possible to run the unit test on that platform?\r\n2. Is it possible to run valgrind on that platform?"}}