Merge remote-tracking branch 'origin/1.11' into work
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "Engine/Core/Utilities.h"
|
||||
#if COMPILE_WITH_PROFILER
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#endif
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
@@ -219,6 +220,10 @@ void PlatformBase::OnMemoryAlloc(void* ptr, uint64 size)
|
||||
tracy::Profiler::MemAllocCallstack(ptr, (size_t)size, 12, false);
|
||||
#endif
|
||||
|
||||
// Register in memory profiler
|
||||
if (ProfilerMemory::Enabled)
|
||||
ProfilerMemory::OnMemoryAlloc(ptr, size);
|
||||
|
||||
// Register allocation during the current CPU event
|
||||
auto thread = ProfilerCPU::GetCurrentThread();
|
||||
if (thread != nullptr && thread->Buffer.GetCount() != 0)
|
||||
@@ -236,6 +241,10 @@ void PlatformBase::OnMemoryFree(void* ptr)
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
// Register in memory profiler
|
||||
if (ProfilerMemory::Enabled)
|
||||
ProfilerMemory::OnMemoryFree(ptr);
|
||||
|
||||
#if TRACY_ENABLE_MEMORY
|
||||
// Track memory allocation in Tracy
|
||||
tracy::Profiler::MemFree(ptr, false);
|
||||
@@ -316,10 +325,11 @@ void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType er
|
||||
Engine::RequestingExit();
|
||||
|
||||
// Collect crash info (platform-dependant implementation that might collect stack trace and/or create memory dump)
|
||||
#if LOG_ENABLE
|
||||
{
|
||||
// Log separation for crash info
|
||||
LOG_FLUSH();
|
||||
Log::Logger::WriteFloor();
|
||||
LOG_FLOOR();
|
||||
LOG(Error, "");
|
||||
LOG(Error, "Critical error! Reason: {0}", msg);
|
||||
LOG(Error, "");
|
||||
@@ -387,6 +397,12 @@ void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType er
|
||||
LOG(Error, "External Used Physical Memory: {0} ({1}%)", Utilities::BytesToText(externalUsedPhysical), (int32)(100 * externalUsedPhysical / memoryStats.TotalPhysicalMemory));
|
||||
LOG(Error, "External Used Virtual Memory: {0} ({1}%)", Utilities::BytesToText(externalUsedVirtual), (int32)(100 * externalUsedVirtual / memoryStats.TotalVirtualMemory));
|
||||
}
|
||||
#if COMPILE_WITH_PROFILER
|
||||
if (error == FatalErrorType::OutOfMemory || error == FatalErrorType::GPUOutOfMemory)
|
||||
{
|
||||
ProfilerMemory::Dump();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (Log::Logger::LogFilePath.HasChars())
|
||||
{
|
||||
@@ -399,13 +415,14 @@ void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType er
|
||||
|
||||
// Capture the original log file
|
||||
LOG(Error, "");
|
||||
Log::Logger::WriteFloor();
|
||||
LOG_FLOOR();
|
||||
LOG_FLUSH();
|
||||
FileSystem::CopyFile(crashDataFolder / TEXT("Log.txt"), Log::Logger::LogFilePath);
|
||||
|
||||
LOG(Error, "Crash info collected.");
|
||||
Log::Logger::WriteFloor();
|
||||
LOG_FLOOR();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Show error message
|
||||
if (Engine::ReportCrash.IsBinded())
|
||||
|
||||
Reference in New Issue
Block a user