mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 15:34:36 +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 );
|
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()
|
void TestFunction()
|
||||||
{
|
{
|
||||||
tracy::SetThreadName( "First/second thread" );
|
tracy::SetThreadName( "First/second thread" );
|
||||||
@ -254,6 +267,16 @@ void OnlyMemory()
|
|||||||
{
|
{
|
||||||
tracy::SetThreadName( "Only memory" );
|
tracy::SetThreadName( "Only memory" );
|
||||||
new int;
|
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 );
|
static TracyLockable( std::mutex, deadlockMutex1 );
|
||||||
|
Loading…
Reference in New Issue
Block a user