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

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2020-09-22 19:22:53 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2020-09-24 02:31:23 +0300
commit4537276e98bf9d5acd2abda0544bb19b0899f957 (patch)
tree8ee340b3011819661c6ff11b51af376d51dc2295 /test
parent4db092437caa4519343322e110d665fd97307462 (diff)
Custom allocator test.
Diffstat (limited to 'test')
-rw-r--r--test/test.cpp23
1 files changed, 23 insertions, 0 deletions
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 );