Ad Space — Top Banner

Out of memory

Sharp Sharp MZ

Severity: Moderate

What Does This Error Mean?

Out of memory on the Sharp MZ means your BASIC program has used all available RAM. Memory varies by model: the MZ-80K has 48KB, the MZ-700 has 64KB. But the BASIC interpreter itself uses some of this memory, leaving less for your program.

Affected Models

  • Sharp MZ-80K
  • Sharp MZ-80A
  • Sharp MZ-80B
  • Sharp MZ-700
  • Sharp MZ-800
  • Sharp MZ-1500
  • Sharp MZ-2500
  • EmuZ emulator

Common Causes

  • Program too large for available RAM after BASIC is loaded
  • Large arrays consuming memory
  • The BASIC interpreter itself takes significant RAM (8-16KB depending on version)
  • String variables accumulating garbage that has not been collected
  • Machine code or data loaded into BASIC's memory area

How to Fix It

  1. Check free memory — the command depends on your BASIC version.

    In most Sharp MZ BASICs, PRINT FRE(0) shows available memory. Some versions use SIZE or MEM instead.

  2. Remove REM statements and shorten variable names.

    Every comment line and long variable name uses precious RAM. On the Sharp MZ, where the BASIC itself is loaded into RAM (unlike machines with BASIC in ROM), every byte counts even more.

  3. Try a smaller BASIC interpreter.

    Some Sharp MZ BASICs are smaller than others. SP-5025 is compact. HuBASIC is larger but more powerful. If your program is simple, a smaller BASIC leaves more room for code.

  4. Reduce array sizes and use integer variables where possible.

    DIM A(100) uses less memory than DIM A(1000). Integer variables (where supported) use less memory than floating-point.

Frequently Asked Questions

Why does the Sharp MZ have less free memory than other computers with the same RAM?

Because the BASIC interpreter is loaded from tape into RAM, it takes up 8-16KB of your memory. On a C64 or Spectrum, BASIC lives in ROM (read-only memory) and does not reduce the RAM available to programs.

Which Sharp MZ model has the most memory?

The MZ-2500 (SuperMZ) has up to 256KB of RAM — by far the most in the MZ family. The MZ-800 has 64KB expandable to 128KB. The earlier MZ-80K has 48KB.