diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 6e19abd9..e9746215 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -36,7 +36,7 @@ namespace tracy double s_time = 0; View::View( void(*cbMainThread)(const std::function&, bool), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config ) - : m_worker( addr, port ) + : m_worker( addr, port, config.memoryLimit == 0 ? -1 : ( config.memoryLimitPercent * tracy::GetPhysicalMemorySize() / 100 ) ) , m_staticView( false ) , m_viewMode( ViewMode::LastFrames ) , m_viewModeHeuristicTry( true ) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 9df61ef0..be781283 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -260,7 +260,7 @@ static bool IsQueryPrio( ServerQuery type ) LoadProgress Worker::s_loadProgress; -Worker::Worker( const char* addr, uint16_t port ) +Worker::Worker( const char* addr, uint16_t port, int64_t memoryLimit ) : m_addr( addr ) , m_port( port ) , m_hasData( false ) @@ -276,6 +276,7 @@ Worker::Worker( const char* addr, uint16_t port ) , m_pendingCallstackFrames( 0 ) , m_pendingCallstackSubframes( 0 ) , m_pendingSymbolCode( 0 ) + , m_memoryLimit( memoryLimit ) , m_callstackFrameStaging( nullptr ) , m_traceVersion( CurrentVersion ) , m_loadTime( 0 ) @@ -317,6 +318,7 @@ Worker::Worker( const char* name, const char* program, const std::vector& timeline, const std::vector& messages, const std::vector& plots, const std::unordered_map& threadNames ); Worker( FileRead& f, EventType::Type eventMask = EventType::All, bool bgTasks = true, bool allowStringModification = false); ~Worker(); @@ -1031,6 +1031,7 @@ private: uint64_t m_memNamePayload = 0; Slab<64*1024*1024> m_slab; + int64_t m_memoryLimit; DataBlock m_data; MbpsBlock m_mbpsData;