?OUT OF MEMORY ERROR
Apple Apple II
Severity: ModerateWhat Does This Error Mean?
?OUT OF MEMORY ERROR means your Applesoft BASIC program has used all available RAM. The Apple II has very limited memory — 48KB on the original II, 64KB on the IIe. You need to shorten your program, reduce variables, or clear unused data.
Affected Models
- Apple II
- Apple II Plus
- Apple IIe
- Apple IIc
- Apple IIGS
- AppleWin emulator
Common Causes
- Program is too large for available RAM
- Too many variables or large string arrays consuming memory
- HIMEM or LOMEM set incorrectly, shrinking usable memory
- Machine language routine loaded in memory leaves less room for BASIC
- Graphics mode (HGR or HGR2) reserves memory, leaving less for the program
How to Fix It
-
Type FREE to check how much memory is available.
If FREE returns a small number (under 1000 bytes), your program is near the limit. Consider which parts of the program can be shortened.
-
Shorten variable names and remove REM statements.
Every REM line and every long variable name uses memory. Removing comments and using short names (A, B, X) instead of long names saves bytes.
-
Avoid storing large strings — use PRINT instead of assigning to variables.
Each string variable reserves memory even after the string is no longer needed. PRINT the text directly instead of storing it in A$ first.
-
If using hi-res graphics, remember HGR reserves 8KB of RAM.
HGR and HGR2 each reserve a page of graphics memory (8KB). If your program does not need graphics, avoid calling HGR to keep that memory available for code.
Frequently Asked Questions
How much memory does an Apple IIe have for BASIC programs?
The Apple IIe has 64KB total, but DOS and the system use some of it. A typical Applesoft BASIC program has roughly 38-40KB available, less if hi-res graphics pages are active.
Can I add more memory to an Apple II?
The original Apple II could be expanded from 4KB to 48KB with RAM cards. The Apple IIe supports an 80-column card that adds 64KB of auxiliary RAM, though Applesoft BASIC cannot use auxiliary RAM directly.