diff options
Diffstat (limited to 'util')
| -rw-r--r-- | util/arena.cu (renamed from util/arena.cc) | 7 | ||||
| -rw-r--r-- | util/arena.cuh (renamed from util/arena.h) | 0 | ||||
| -rw-r--r-- | util/arena_test.cu (renamed from util/arena_test.cc) | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/util/arena.cc b/util/arena.cu index 46e3b2e..09ec6e6 100644 --- a/util/arena.cc +++ b/util/arena.cu @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#include "util/arena.h" +#include "util/arena.cuh" namespace leveldb { @@ -13,7 +13,7 @@ Arena::Arena() Arena::~Arena() { for (size_t i = 0; i < blocks_.size(); i++) { - delete[] blocks_[i]; + cudaFree(blocks_[i]); } } @@ -56,7 +56,8 @@ char* Arena::AllocateAligned(size_t bytes) { } char* Arena::AllocateNewBlock(size_t block_bytes) { - char* result = new char[block_bytes]; + char* result = nullptr; + cudaMallocManaged((void **)&result, sizeof(char) * block_bytes); blocks_.push_back(result); memory_usage_.fetch_add(block_bytes + sizeof(char*), std::memory_order_relaxed); diff --git a/util/arena.h b/util/arena.cuh index 68fc55d..68fc55d 100644 --- a/util/arena.h +++ b/util/arena.cuh diff --git a/util/arena_test.cc b/util/arena_test.cu index 90226fe..9b87785 100644 --- a/util/arena_test.cc +++ b/util/arena_test.cu @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. -#include "util/arena.h" +#include "util/arena.cuh" +#include "util/random.h" #include "gtest/gtest.h" -#include "util/random.h" namespace leveldb { |
