diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-23 16:33:43 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-26 19:43:08 +0300 |
commit | d4fcad2aff4d221d0066061edc24bafc71af8e3d (patch) | |
tree | b53841c61bf3bbd049fa7d1bba2303c1fc19f18c | |
parent | 25c48b197b9c41b9be64e1f357e8ec845405576d (diff) | |
download | qtlocation-mapboxgl-d4fcad2aff4d221d0066061edc24bafc71af8e3d.tar.gz |
[test runner] Overload global new/delete
-rw-r--r-- | render-test/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/render-test/main.cpp b/render-test/main.cpp index ef9352d21d..46447f5853 100644 --- a/render-test/main.cpp +++ b/render-test/main.cpp @@ -1,3 +1,5 @@ +#include "allocation_index.hpp" + #include <mbgl/util/run_loop.hpp> #include <mbgl/util/io.hpp> @@ -19,6 +21,21 @@ #define ANSI_COLOR_LIGHT_GRAY "\x1b[90m" #define ANSI_COLOR_RESET "\x1b[0m" +void* operator new(std::size_t sz) { + void* ptr = AllocationIndex::allocate(sz); + if (!ptr) throw std::bad_alloc{}; + + return ptr; +} + +void operator delete(void* ptr) noexcept { + AllocationIndex::deallocate(ptr); +} + +void operator delete(void* ptr, size_t) noexcept { + AllocationIndex::deallocate(ptr); +} + namespace { TestPaths makeTestPaths(mbgl::filesystem::path stylePath) { |