@Test
	public void testOverlaySpaces() throws Exception {
		try (Transaction tx = b.startTransaction()) {
			AddressSpace os = b.trace.getMemoryManager()
					.createOverlayAddressSpace("test",
						b.trace.getBaseAddressFactory().getDefaultAddressSpace());
			DBTraceCodeSpace space = manager.getCodeSpace(os, true);

			b.addInstruction(0, os.getAddress(0x4004), b.host, b.buf(0xf4, 0));

			List<CodeUnit> all = new ArrayList<>();
			space.definedUnits().get(0, true).forEach(all::add);
			assertEquals(1, all.size());
			assertEquals(os, all.get(0).getAddress().getAddressSpace());
		}
	}
This test is interesting because the pointer type def causes an update to the data type
settings <em>while the unit is still being created</em>. This will invalidate the trace's
caches. All of them, including the defined data units, which can become the cause of many
timing issues.
Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeManagerTest.java