mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-26 14:51:48 -03:00
Add debug options and jemalloc support for Linux memory issues
Debug env vars for clientPatcher: - HYTALE_SKIP_SENTRY_PATCH=1 - Skip sentry URL patch (60->26 chars) - HYTALE_SKIP_SUBDOMAIN_PATCH=1 - Skip subdomain prefix patches Game launcher Linux options: - HYTALE_USE_JEMALLOC=1 - Use jemalloc allocator instead of glibc This helps isolate which patch causes "free(): invalid pointer" on Steam Deck and Ubuntu LTS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -285,12 +285,30 @@ exec "$REAL_JAVA" "\${ARGS[@]}"
|
||||
const gpuEnv = setupGpuEnvironment(gpuPreference);
|
||||
Object.assign(env, gpuEnv);
|
||||
|
||||
// Disable glibc heap validation on Linux to prevent false positive
|
||||
// "free(): invalid pointer" crashes on Steam Deck and Ubuntu LTS
|
||||
// This doesn't hide real bugs - the same binary works on other systems
|
||||
// Linux memory allocator fixes for "free(): invalid pointer" crashes
|
||||
// on Steam Deck (glibc 2.41) and Ubuntu LTS
|
||||
if (process.platform === 'linux') {
|
||||
// Option 1: Disable glibc heap validation
|
||||
env.MALLOC_CHECK_ = '0';
|
||||
console.log('Linux detected: Setting MALLOC_CHECK_=0 to disable glibc heap validation');
|
||||
|
||||
// Option 2: Try to use jemalloc if available (more robust allocator)
|
||||
// User can set HYTALE_USE_JEMALLOC=1 to enable
|
||||
if (process.env.HYTALE_USE_JEMALLOC === '1') {
|
||||
const jemalloc = require('fs').existsSync('/usr/lib/libjemalloc.so.2')
|
||||
? '/usr/lib/libjemalloc.so.2'
|
||||
: require('fs').existsSync('/usr/lib/x86_64-linux-gnu/libjemalloc.so.2')
|
||||
? '/usr/lib/x86_64-linux-gnu/libjemalloc.so.2'
|
||||
: null;
|
||||
|
||||
if (jemalloc) {
|
||||
env.LD_PRELOAD = jemalloc + (env.LD_PRELOAD ? ':' + env.LD_PRELOAD : '');
|
||||
console.log(`Linux: Using jemalloc allocator (${jemalloc})`);
|
||||
} else {
|
||||
console.log('Linux: jemalloc not found, using glibc with MALLOC_CHECK_=0');
|
||||
}
|
||||
} else {
|
||||
console.log('Linux: Using glibc with MALLOC_CHECK_=0 (set HYTALE_USE_JEMALLOC=1 to try jemalloc)');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user