[TensorFlow] Microsoft C++ exception: std::bad_alloc at memory location 0x00000071F8AFC730
Microsoft C++ exception: std::bad_alloc at memory location 0x00000071F8AFC730
Visual Studio 2015 환경에서 TensorFlow 를 구동할 때 Debug 모드로 실행하면 날 수 있는 에러이다.
빨리 해결하기 위해서는 Debug 모드가 아닌 Release 모드로 실행하길 바란다.
github 이슈와 어떤 포럼에 의하면 아래와 같다.
I think this is a known limitation of MSVC, e.g. see this forum post.
Presumably the issue is a different memory layout for std::string in the two libraries,
and this will affect many of our C++ APIs.
It might work if you replace the uses of the C++ API with equivalent calls to TensorFlow's C API.
간단히 말하자면 STL 때문인데, C++ API 사용하려면 TensorFlow 의 C API 에 대해 동등한 호출로 바꾸면 된다.
자세히 말하자면, 동적으로 할당된 메모리를 내부적으로 처리하는 클래스를 반환하는데 문제가 있다고 한다.
std::sting 및 기타 STL 클래스의 내부는 디버그 빌드와 릴리즈 빌드에서 다르다고 한다.
이러한 클래스를 내보내려면 앱과 DLL을 동일한 컴파일러, 컴파일러 버전 및 컴파일러 옵션으로 빌드해야한다고 한다.
또한 앱과 DLL은 다중 스레드 DLL 런타임 라이브러리를 사용해야한다. 이렇게 하지않으면 실행하다가 프로그램이 죽어버린다.
bad_alloc: debug mode application calls release dll
bad_alloc: debug mode application calls release dll Hi, all, I have release version dll, which exports std::string and stl stuffs when I build my application release model calling release dll, there is no any problem. However, when I build my application i
forums.codeguru.com
참고자료 2 : https://github.com/tensorflow/tensorflow/issues/17778
Bad_alloc when building standalone project in Debug · Issue #17778 · tensorflow/tensorflow
System information Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 TensorFlow...
github.com
참고자료 3 : https://github.com/tensorflow/tensorflow/issues/19906
Build OK ,but My own C++ project has error :" std::bad_alloc " · Issue #19906 · tensorflow/tensorflow
System information: · Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes · OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Win10-x64 · Tens...
github.com