Hydra Engine

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:

OSPath
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

KeyEnvironmentDefaultMeaning
idleTimeoutGHIDRA_SESSION_IDLE_TIMEOUT0Seconds without clients before the daemon exits; 0 stays up.
keepWarmGHIDRA_SESSION_KEEP_WARM3600Seconds an unused read-only program or project stays open.
maxQuickCPU countConcurrent quick requests.
maxLongCPU / 4, at least 2Concurrent long requests.
maxImportsCPU / 4, 1 to 4Concurrent imports, across all projects.
scriptPath[]Extra GhidraScript folders.
log<state>/<instance>.logThe daemon's log.

JVM

KeyEnvironmentDefaultMeaning
javaGHIDRA_SESSION_JAVA_HOMEdiscoveredJDK home.
maxHeapGHIDRA_SESSION_MAXMEMa quarter of RAM, 2-31 GiB-Xmx. G1 takes only what it needs and returns idle memory.
minHeap512m-Xms.
gcGHIDRA_SESSION_GCg1g1, zgc, parallel or default.
vmargsGHIDRA_SESSION_VMARGS[]Extra JVM options, added last.
tmpdirGHIDRA_SESSION_TMPDIRthe JVM'sWhere Ghidra keeps unsaved database buffers. A fast disk with room.
modeGHIDRA_SESSION_MODEfastfast or standard class loading.
aotGHIDRA_SESSION_AOTautoUse the AOT cache when one exists, or off.
classCachetrueCache Ghidra's extension-point scan.

Projects and caches

KeyEnvironmentDefaultMeaning
upgradeCacheGHIDRA_SESSION_UPGRADE_CACHEtrueServe older-format programs from an upgraded copy.
upgradeCacheDirGHIDRA_SESSION_UPGRADE_CACHE_DIR<state>/upgrade-cacheWhere those copies live; best on the projects' volume.
forkCopyLimitMbGHIDRA_SESSION_FORK_COPY_LIMIT_MB2048Largest 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; status reports memory.usedMb and maxMb.
  • 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 tmpdir on NTFS if you can: ReFS writes Ghidra's buffer files back more slowly.