From 4537276e98bf9d5acd2abda0544bb19b0899f957 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 22 Sep 2020 18:22:53 +0200 Subject: Custom allocator test. --- test/test.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/test.cpp b/test/test.cpp index 1d972511..325620fb 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -33,6 +33,19 @@ void operator delete( void* ptr ) noexcept free( ptr ); } +void* CustomAlloc( size_t count ) +{ + auto ptr = malloc( count ); + TracyAllocNS( ptr, count, 10, "Custom alloc" ); + return ptr; +} + +void CustomFree( void* ptr ) +{ + TracyFreeNS( ptr, 10, "Custom alloc" ); + free( ptr ); +} + void TestFunction() { tracy::SetThreadName( "First/second thread" ); @@ -254,6 +267,16 @@ void OnlyMemory() { tracy::SetThreadName( "Only memory" ); new int; + + void* ptrs[16]; + for( int i=1; i<16; i++ ) + { + ptrs[i] = CustomAlloc( i * 1024 ); + } + for( int i=1; i<16; i++ ) + { + CustomFree( ptrs[i] ); + } } static TracyLockable( std::mutex, deadlockMutex1 ); -- cgit v1.2.3