Fix memory issues on Web
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
class FLAXENGINE_API UnixPlatform : public PlatformBase
|
||||
{
|
||||
public:
|
||||
|
||||
// [PlatformBase]
|
||||
static void* Allocate(uint64 size, uint64 alignment);
|
||||
static void Free(void* ptr);
|
||||
|
||||
@@ -179,15 +179,6 @@ void WebPlatform::Log(const StringView& msg, int32 logType)
|
||||
emscripten_log(flags, buffer);
|
||||
}
|
||||
|
||||
#if !BUILD_RELEASE
|
||||
|
||||
bool WebPlatform::IsDebuggerPresent()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
String WebPlatform::GetComputerName()
|
||||
{
|
||||
return TEXT("Web");
|
||||
@@ -335,7 +326,7 @@ Array<PlatformBase::StackFrame> WebPlatform::GetStackFrames(int32 skipCount, int
|
||||
Array<StackFrame> result;
|
||||
#if CRASH_LOG_ENABLE
|
||||
// Get callstack
|
||||
char callstack[1024];
|
||||
char callstack[2000];
|
||||
emscripten_get_callstack(EM_LOG_JS_STACK, callstack, sizeof(callstack));
|
||||
|
||||
// Parse callstack
|
||||
|
||||
@@ -111,7 +111,10 @@ public:
|
||||
static void GetUTCTime(int32& year, int32& month, int32& dayOfWeek, int32& day, int32& hour, int32& minute, int32& second, int32& millisecond);
|
||||
static void Log(const StringView& msg, int32 logType = 1);
|
||||
#if !BUILD_RELEASE
|
||||
static bool IsDebuggerPresent();
|
||||
static bool IsDebuggerPresent()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
static String GetComputerName();
|
||||
static bool GetHasFocus();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Core/Types/StringView.h"
|
||||
|
||||
#if PLATFORM_WEB
|
||||
#if PLATFORM_WEB && PLATFORM_SIMD_SSE2
|
||||
#define RAPIDJSON_SSE2
|
||||
#elif PLATFORM_SIMD_SSE4_2
|
||||
#define RAPIDJSON_SSE42
|
||||
|
||||
@@ -169,8 +169,10 @@ namespace Flax.Build.Platforms
|
||||
args.Add("-fsanitize=address");
|
||||
if (sanitizers.HasFlag(Sanitizer.Undefined))
|
||||
args.Add("-fsanitize=undefined");
|
||||
if (sanitizers == Sanitizer.None)
|
||||
args.Add("-fsanitize=null -fsanitize-minimal-runtime"); // Minimal Runtime
|
||||
//if (sanitizers == Sanitizer.None && options.Configuration != TargetConfiguration.Release)
|
||||
// args.Add("-fsanitize=null -fsanitize-minimal-runtime"); // Minimal Runtime
|
||||
if (sanitizers == Sanitizer.None) // TODO: fix random memory issues around malloc (eg. when resizing canvas) that are not happening when using Address sanitizer (wierd)
|
||||
args.Add("-fsanitize=address");
|
||||
|
||||
if (Configuration.WebThreads)
|
||||
args.Add("-pthread");
|
||||
@@ -289,7 +291,12 @@ namespace Flax.Build.Platforms
|
||||
initialMemory = Math.Max(initialMemory, 64); // Address Sanitizer needs more memory
|
||||
args.Add($"-sINITIAL_MEMORY={initialMemory}MB");
|
||||
args.Add("-sSTACK_SIZE=4MB");
|
||||
args.Add("-sASYNCIFY_STACK_SIZE=8192");
|
||||
args.Add("-sALLOW_MEMORY_GROWTH=1");
|
||||
//args.Add("-sSAFE_HEAP=1");
|
||||
args.Add("-sABORTING_MALLOC=0");
|
||||
//args.Add("-sMALLOC=emmalloc-memvalidate");
|
||||
//args.Add("-sMALLOC=emmalloc");
|
||||
|
||||
// Setup file access (Game Cooker packs files with file_packager tool)
|
||||
args.Add("-sFORCE_FILESYSTEM");
|
||||
|
||||
Reference in New Issue
Block a user