protected static final Address getMaxDefinedMemoryAddress(Program program) {
		Address maxAddr = null;
		for (MemoryBlock block : program.getMemory().getBlocks()) {
			if (block.getStart().getAddressSpace().isOverlaySpace()) {
				continue;
			}
			if (maxAddr == null || maxAddr.compareTo(block.getEnd()) < 0) {
				maxAddr = block.getEnd();
			}
		}
		return maxAddr;
	}
Get the maximum defined memory address ignoring any overlays which have been defined.
@return max defined physical address
Ghidra/Features/Base/src/main/java/ghidra/test/processors/support/ProcessorEmulatorTestAdapter.java