Diagnosing and Resolving WS FULL Errors in Dyalog APL
Step‑by‑step guide to identify why Dyalog APL raises WS FULL, diagnose the cause, apply the appropriate fix, and verify the result.
12 May 2026, 15:32 UTC

Recognizing a WS FULL Condition
When Dyalog APL cannot allocate memory for an operation, it raises the error WS FULL. The message appears immediately after the expression that triggered the allocation attempt, and the interpreter returns to the prompt without producing a result.
Common Causes and Diagnostic Indicators
| Cause | Typical Symptom | Diagnostic Clue |
|---|---|---|
| Large numeric or character array exceeding workspace limit | Error occurs on array creation or reshaping | ⎕WA shows very low free space before the failing expression |
| Deep or infinite recursion consuming stack space | Error appears inside a user‑defined function, often after many nested calls | ⎕WA may still report reasonable free space; the call stack grows until WS FULL |
| Accumulation of temporary results in chained expressions | Error after a sequence of operations that each produce intermediate arrays | ⎕WA drops sharply after each step; using ⎕SH or ⎕ERASE reduces usage |
| Loading a large external workspace or file without clearing prior objects | Error during ⎕LOAD or ⎕CY, even if the incoming object alone would fit | ⎕WA before load is already high; after load it exceeds limit |
Ordered Diagnostic Checks
- Check free workspace: Run
⎕WAto see the current free bytes. If the value is close to zero, the workspace is exhausted. - Identify the triggering expression: Re‑run the last command that produced WS FULL and note whether it is an array literal, a function call, a file load, or a complex expression.
- Inspect array sizes: For suspected large arrays, print their shape with
⍴before creation (if possible) or examine the code for constants like10000 10000 ⍴ 0. - Look for recursion: Open the function definition and verify that a base case exists and that the recursive call moves toward it. Use
⎕TRACEto see call depth if needed. - Review temporary result handling: Search for chains of operators without intermediate
⎕SHor⎕ERASE. Consider inserting⎕SHafter each major step to release memory. - Check recent loads: If you used
⎕LOADor⎕CY, list the current objects with⎕NLand see whether large namespaces remain from previous loads.
Fixes Tied to Findings
- Reduce array size or increase workspace:
- If the array is genuinely needed, raise the workspace limit with
⎕WSIZE ← newSizewherenewSizeis a byte count (e.g.,⎕WSIZE ← 200000000for ~200 MB). - Verify that
newSizedoes not exceed available RAM; otherwise enable swap cautiously.
- If the array is genuinely needed, raise the workspace limit with
- Mitigate recursion depth:
- Add a proper base case or convert the algorithm to an iterative form using
⍣or explicit loops. - If deep recursion is unavoidable, increase
⎕WSIZEas above, but monitor stack usage.
- Add a proper base case or convert the algorithm to an iterative form using
- Clear temporaries:
- Insert
⎕SHafter each major intermediate result, e.g.,temp ← … ⋄ ⎕SH temp. - Alternatively, use
⎕ERASE nameto delete specific objects no longer needed.
- Insert
- Manage workspace loads:
- Before loading a new workspace, execute
⎕ERASE ⎕NL 2to clear existing namespaces, or save the current workspace with⎕SAVEand start a fresh session. - After loading, immediately check
⎕WAto confirm sufficient free space remains.
- Before loading a new workspace, execute
Escalation Criteria
- If increasing
⎕WSIZEto a value that matches your system’s RAM still results in WS FULL, the algorithm likely requires more memory than physically available; consider out‑of‑core techniques or data chunking. - When recursion depth exceeds a few thousand calls and stack overflow persists despite workspace increases, redesign the algorithm to avoid deep recursion.
- If WS FULL occurs repeatedly after applying the above fixes and you suspect a bug in Dyalog’s memory manager (e.g., with a specific version), collect the exact APL version (
⎕AV), the offending expression, and⎕WAbefore and after the error, then contact Dyalog support.
Verification and Rollback
After applying a fix, re‑run the expression that previously caused WS FULL. Successful execution without error confirms the fix. Then run ⎕WA to ensure a reasonable amount of free workspace remains (e.g., >10 % of the total ⎕WSIZE).
If you changed ⎕WSIZE and need to revert, store the original size first:
originalSize ← ⎕WSIZE ⍑ remember current limit ⎕WSIZE ← 150000000 ⍑ example increase … test … ⎕WSIZE ← originalSize ⍑ rollback to prior limitNote that changing
⎕WSIZEalters the interpreter’s memory allocation; rolling back restores the previous limit and frees any extra reserved memory.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.