public static MemoryBlock[] getMemBlocks(Program program, boolean withBytes) {
		Memory mem = program.getMemory();
		MemoryBlock[] blocks = mem.getBlocks();
		MemoryBlock[] tmpBlocks = new MemoryBlock[blocks.length];
		int j = 0;
		for (MemoryBlock block : blocks) {
			if ((block.isInitialized() && withBytes) || (!block.isInitialized() && !withBytes)) {
				tmpBlocks[j++] = block;
			}
		}
		MemoryBlock[] typeBlocks = new MemoryBlock[j];
		System.arraycopy(tmpBlocks, 0, typeBlocks, 0, j);
		return typeBlocks;
	}
Gets the program memory blocks of the indicated type for the 
specified program.
@param program the program whose memory blocks we want.
@param withBytes if true include blocks that have their own bytes. If false, include only
blocks that don't have their own bytes (this includes bit and byte mapped blocks)
@return an array of program memory blocks
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMemoryUtil.java