Skip to content

Commit

Permalink
fix Issue 2865 (#2883)
Browse files Browse the repository at this point in the history
* fix #2871

* move test binaries to their own directory

* smoke test (#2880)

* fix review comments

* fix #2865

* minor

* clang-format

Co-authored-by: Samuel Li <shaomeng@cisl-vapor>
Co-authored-by: sgpearse <pearse@ucar.edu>
  • Loading branch information
3 people committed Nov 12, 2021
1 parent df5a85b commit 1391912
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test_apps/smokeTests/gridTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::vector<void *> Heap;

void DeleteHeap()
{
for (size_t i = 0; i < Heap.size(); i++) ::operator delete(Heap[i]);
for (size_t i = 0; i < Heap.size(); i++) std::free(Heap[i]);
}

template<typename T> vector<T *> AllocateBlocksType(const vector<size_t> &bs, const vector<size_t> &dims)
Expand All @@ -54,9 +54,10 @@ template<typename T> vector<T *> AllocateBlocksType(const vector<size_t> &bs, co
nblocks *= nb;
}

T *buf = new T[nblocks * block_size];
void *tmp = std::malloc(sizeof(T) * nblocks * block_size);
T * buf = static_cast<T *>(tmp);

Heap.push_back(buf);
Heap.push_back(tmp);

std::vector<T *> blks;
for (size_t i = 0; i < nblocks; i++) { blks.push_back(buf + i * block_size); }
Expand Down

0 comments on commit 1391912

Please sign in to comment.