@Override
	public void removeBlock(MemoryBlock block, TaskMonitor monitor) throws LockException {
		lock.acquire();
		try {
			program.checkExclusiveAccess();
			checkBlock(block);
			MemoryBlockDB memBlock = (MemoryBlockDB) block;

			Address startAddress = block.getStart();
			Address endAddress = block.getEnd();

			program.setEventsEnabled(false);// ensure that no domain object change
			// events go out that would cause screen updates;
			// the code manager will be locked until the remove is done

			try {
				program.deleteAddressRange(startAddress, endAddress, monitor);
				memBlock.delete();
				removeFromAllAddressSet(startAddress, endAddress);
				initializeBlocks();
			}
			catch (IOException e) {
				program.dbError(e);
			}
			finally {
				program.setEventsEnabled(true);
			}

			fireBlockRemoved(startAddress);
			if (startAddress.getAddressSpace() instanceof OverlayAddressSpace os) {
				attemptOverlaySpaceRemoval(os);
			}
		}
		finally {
			lock.release();
		}
	}
Tests if the memory contains a sequence of contiguous bytes that match the given byte array
at all bit positions where the mask contains an "on" bit. The test will be something like

<PRE>
 for(int i = 0; i &lt; bytes.length; i++) {
    if (bytes[i] != memory.getByte(addr+i) &amp; masks[i]) {
        return false;
    }
}
</PRE>

@param addr The beginning address in memory to test against.
@param bytes the array of bytes to test for.
@param masks the array of masks. (One for each byte in the byte array)
@param forward if true, the matching is going forward, otherwise backward

@return 1 if there is a match 0 if there is no match -i if no match is found, this is the
        number of bytes that can be safely skipped
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/MemoryMapDB.java