# How to Fix Memory Leaks on Your Palworld Server (/docs/palworld/memory-leak-fix)



import { Step, Steps } from 'fumadocs-ui/components/steps';

Palworld dedicated servers have a well-known memory leak — RAM usage grows over time until the server starts rubber-banding, freezing, or OOM-crashing. The good news: there are three concrete fixes that, combined, completely tame it. None of them require mods.

TL;DR — The Three Fixes [#tldr--the-three-fixes]

| Fix                                                 | Effort     | Impact                    |
| --------------------------------------------------- | ---------- | ------------------------- |
| Disable raid invaders (`bEnableInvaderEnemy=False`) | 30 seconds | **Cuts RAM use by \~50%** |
| Schedule periodic restarts (every 2–4h)             | 5 minutes  | Caps memory growth        |
| Tune `AutoSaveSpan`                                 | 30 seconds | Smaller save spikes       |

Fix #1: Disable Raid Invaders [#fix-1-disable-raid-invaders]

This is the single biggest win. Pal raids spawn waves of high-poly enemies that the server holds in memory and never cleans up properly. Disabling them is the closest thing Palworld has to an official memory-leak workaround.

<Steps>
  <Step>
    Stop your server from **Console** in the [XGamingServer Panel](https://panel.xgamingserver.com).
  </Step>

  <Step>
    Open `Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` in **Files**. Inside the `OptionSettings=(...)` line, find or add:

    ```ini
    bEnableInvaderEnemy=False
    ```
  </Step>

  <Step>
    Save and start the server. Memory usage on a fresh start should drop by roughly half compared to the same world with invaders enabled.
  </Step>
</Steps>

Players still get base raids from wild Pals — only the scripted invader waves are disabled.

Fix #2: Schedule Periodic Restarts [#fix-2-schedule-periodic-restarts]

Palworld's memory leak is gradual. Even with invaders off, RAM creeps upward. Restarting the server **resets the leak completely** — and on XGamingServer you can schedule this without ever logging in.

| Server Size               | Memory | Restart Frequency |
| ------------------------- | ------ | ----------------- |
| Small (1–4 players)       | 4 GB   | Every 4–6 hours   |
| Medium (5–16 players)     | 8 GB   | Every 2–4 hours   |
| Large (17–32 players)     | 12+ GB | Every 1–2 hours   |
| **With invaders enabled** | any    | **Every hour**    |

Set Up a Scheduled Restart [#set-up-a-scheduled-restart]

<Steps>
  <Step>
    In the [XGamingServer Panel](https://panel.xgamingserver.com), open the **Schedules** tab.
  </Step>

  <Step>
    Click **New Schedule**. Name it "Auto restart" and set the cron expression — `0 */4 * * *` runs every 4 hours.
  </Step>

  <Step>
    Add a task: **Power Action** → **Restart**. Save.
  </Step>
</Steps>

The server will now restart on its own. Players get auto-saved before shutdown so progress is preserved.

Fix #3: Tune Auto-Save Frequency [#fix-3-tune-auto-save-frequency]

Palworld saves the world every `AutoSaveSpan` seconds. The default is `15.000000` — three save spikes a minute. On a memory-pressured server, those spikes hurt; spreading them out helps.

In `PalWorldSettings.ini`:

```ini
AutoSaveSpan=30.000000
```

| Value       | Behavior                                                  |
| ----------- | --------------------------------------------------------- |
| `15.000000` | Default — saves every 15 seconds                          |
| `30.000000` | Save every 30 seconds (good middle ground)                |
| `60.000000` | Save every minute (less I/O, slightly more lost on crash) |

Don't set this above 60 — you'll lose meaningful progress if the server crashes between saves.

What NOT To Do [#what-not-to-do]

| Don't                                                        | Why                                                                                              |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| **Don't add more RAM**                                       | The leak grows to fill whatever RAM is available. More RAM = longer wait until the same crash.   |
| **Don't disable backups**                                    | The backup save isn't the leak. Disabling it just means you lose data when the leak crashes you. |
| **Don't lower `ServerReplicatePawnCullDistance` below 5000** | Pals stop syncing properly. Players see frozen Pals.                                             |
| **Don't run multiple servers in the same container**         | Their memory use compounds and you get OOM-killed faster.                                        |

Verifying the Fix [#verifying-the-fix]

After applying all three, watch the memory usage in the panel sidebar over 2–3 hours:

* **Before fix:** RAM climbs steadily, hits the cap, server freezes or OOMs
* **After fix:** RAM stabilizes at a sustainable level, scheduled restart resets it before any climb becomes a problem

If you're still seeing climbs, double-check `bEnableInvaderEnemy=False` actually saved into `OptionSettings=()` (the panel sometimes reverts edits if you don't stop the server first).

Related Guides [#related-guides]

* [Performance Optimization](/docs/palworld/optimize-performance)
* [Server Settings Reference](/docs/palworld/server-settings)
* [Raid Settings](/docs/palworld/raid-settings)
* [Fix Common Issues](/docs/palworld/fix-common-issues)
