fixes a memory corruption on windows/gpu (#5288)
* use port::aligned_free() to free allocations from port::aligned_alloc(). This was resulting in memory corruptions on windows. * windows doesn't use LD_LIBRARY_PATH so don't print it. it was actually crashing instead of printing the error message since getenv() returns null.
This commit is contained in:
parent
e7066fb9c1
commit
443fea9b73
@ -173,7 +173,7 @@ class BasicCPUAllocator : public SubAllocator {
|
||||
void* Alloc(size_t alignment, size_t num_bytes) override {
|
||||
return port::aligned_malloc(num_bytes, alignment);
|
||||
}
|
||||
void Free(void* ptr, size_t num_bytes) override { free(ptr); }
|
||||
void Free(void* ptr, size_t num_bytes) override { port::aligned_free(ptr); }
|
||||
};
|
||||
|
||||
// Allocator for pinned CPU RAM that is made known to CUDA for the
|
||||
|
@ -117,7 +117,10 @@ string GetCudnnVersion() { return TF_CUDNN_VERSION; }
|
||||
port::Env::Default()->LoadLibrary(path_string.c_str(), dso_handle);
|
||||
if (!s.ok()) {
|
||||
LOG(INFO) << "Couldn't open CUDA library " << path
|
||||
<< ". LD_LIBRARY_PATH: " << getenv("LD_LIBRARY_PATH");
|
||||
#if !defined(PLATFORM_WINDOWS)
|
||||
<< ". LD_LIBRARY_PATH: " << getenv("LD_LIBRARY_PATH")
|
||||
#endif
|
||||
;
|
||||
return port::Status(port::error::FAILED_PRECONDITION,
|
||||
port::StrCat("could not dlopen DSO: ", path,
|
||||
"; dlerror: ", s.error_message()));
|
||||
|
Loading…
Reference in New Issue
Block a user