Configuration
Sensible defaults, and the settings for when they don't fit.
Settings come from four places, each overriding the one before: built-in defaults, config.json in the state directory, environment variables, command-line options. The daemon reads them when it starts, so stop it and start it again after a change.
The state directory
--state, else GHIDRA_SESSION_HOME, else per user:
| OS | Path |
|---|---|
| Windows | %LOCALAPPDATA%\GhidraSession |
| macOS | ~/Library/Application Support/GhidraSession |
| Linux | $XDG_STATE_HOME/ghidra-session or ~/.local/state/ghidra-session |
It holds config.json, the endpoint and lock files, logs, and the class, AOT and upgrade caches. On POSIX it's created owner-only.
An example
config.json
{ "maxHeap": "16g", "tmpdir": "D:/ghidra-tmp", "idleTimeout": 7200, "maxImports": 2, "scriptPath": ["C:/re/scripts"]}Check what the daemon will actually use with python $GS config.
Daemon
| Key | Environment | Default | Meaning |
|---|---|---|---|
idleTimeout | GHIDRA_SESSION_IDLE_TIMEOUT | 0 | Seconds without clients before the daemon exits; 0 stays up. |
keepWarm | GHIDRA_SESSION_KEEP_WARM | 3600 | Seconds an unused read-only program or project stays open. |
maxQuick | CPU count | Concurrent quick requests. | |
maxLong | CPU / 4, at least 2 | Concurrent long requests. | |
maxImports | CPU / 4, 1 to 4 | Concurrent imports, across all projects. | |
scriptPath | [] | Extra GhidraScript folders. | |
log | <state>/<instance>.log | The daemon's log. |
JVM
| Key | Environment | Default | Meaning |
|---|---|---|---|
java | GHIDRA_SESSION_JAVA_HOME | discovered | JDK home. |
maxHeap | GHIDRA_SESSION_MAXMEM | a quarter of RAM, 2-31 GiB | -Xmx. G1 takes only what it needs and returns idle memory. |
minHeap | 512m | -Xms. | |
gc | GHIDRA_SESSION_GC | g1 | g1, zgc, parallel or default. |
vmargs | GHIDRA_SESSION_VMARGS | [] | Extra JVM options, added last. |
tmpdir | GHIDRA_SESSION_TMPDIR | the JVM's | Where Ghidra keeps unsaved database buffers. A fast disk with room. |
mode | GHIDRA_SESSION_MODE | fast | fast or standard class loading. |
aot | GHIDRA_SESSION_AOT | auto | Use the AOT cache when one exists, or off. |
classCache | true | Cache Ghidra's extension-point scan. |
Projects and caches
| Key | Environment | Default | Meaning |
|---|---|---|---|
upgradeCache | GHIDRA_SESSION_UPGRADE_CACHE | true | Serve older-format programs from an upgraded copy. |
upgradeCacheDir | GHIDRA_SESSION_UPGRADE_CACHE_DIR | <state>/upgrade-cache | Where those copies live; best on the projects' volume. |
forkCopyLimitMb | GHIDRA_SESSION_FORK_COPY_LIMIT_MB | 2048 | Largest full copy fork_project makes in auto mode. |
Sizing memory
- A large analysed program, such as a 1.5 GB project with 240,000 functions, needs a few GiB of heap once open. Several projects add up;
statusreportsmemory.usedMbandmaxMb. - Each running import holds its whole program until it's saved: about 0.7 GB of heap per 25 MB PE.
- Heaps of 32 GiB or more turn off compressed pointers, which costs memory; the default stops at 31.
- On a Windows Dev Drive, put
tmpdiron NTFS if you can: ReFS writes Ghidra's buffer files back more slowly.