1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Track server memory usage.

This commit is contained in:
Bartosz Taudul
2017-09-17 01:22:46 +02:00
parent ab033188d8
commit 447f042c9a
5 changed files with 37 additions and 1 deletions
+5
View File
@@ -4,6 +4,8 @@
#include <assert.h>
#include <stdint.h>
#include "TracyMemory.hpp"
namespace tracy
{
@@ -24,6 +26,7 @@ public:
~Vector()
{
memUsage.fetch_sub( m_capacity * sizeof( T ), std::memory_order_relaxed );
delete[] m_ptr;
}
@@ -77,9 +80,11 @@ private:
if( m_capacity == 0 )
{
m_capacity = 64;
memUsage.fetch_add( m_capacity * sizeof( T ), std::memory_order_relaxed );
}
else
{
memUsage.fetch_add( m_capacity * sizeof( T ), std::memory_order_relaxed );
m_capacity *= 2;
}
T* ptr = new T[m_capacity];