mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Custom allocator test.
This commit is contained in:
parent
4db092437c
commit
4537276e98
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user