Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/marian.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2018-12-13 02:08:55 +0300
committerMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2018-12-13 02:08:55 +0300
commit19cfb307c4e9dec1a5cd1a8b4ea1b6a2aa0948a8 (patch)
tree10dd3c2eddaa1dee73d6152d348f38056b936252
parent28629ea516bd34752f1b88d90f7f65a6f4f6083b (diff)
add _aligned_free for windows
-rw-r--r--src/tensors/cpu/device.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tensors/cpu/device.cpp b/src/tensors/cpu/device.cpp
index 44c8110f..04a79ae6 100644
--- a/src/tensors/cpu/device.cpp
+++ b/src/tensors/cpu/device.cpp
@@ -29,6 +29,12 @@ Device::~Device() {
#define MALLOC(size) malloc(size)
#endif
+#ifdef _WIN32
+#define FREE(ptr) _aligned_free(ptr)
+#else
+#define FREE(ptr) free(ptr)
+#endif
+
void Device::reserve(size_t size) {
size = align(size);
ABORT_IF(size < size_ || size == 0,
@@ -37,7 +43,7 @@ void Device::reserve(size_t size) {
if(data_) {
uint8_t *temp = static_cast<uint8_t*>(MALLOC(size));
std::copy(data_, data_ + size_, temp);
- free(data_);
+ FREE(data_);
data_ = temp;
} else {
data_ = static_cast<uint8_t*>(MALLOC(size));