private void loadReferences() {
		if (!references.isEmpty()) {
			return; // already loaded
		}

		// arbitrary limit to prevent excessive consumption of resources
		int space = getAvailableSpace();
		int max = Math.min(100, space);
		Program program = codeUnit.getProgram();
		ReferenceManager referenceManager = program.getReferenceManager();
		AddressSet addresses = new AddressSet(codeUnit.getMinAddress(), codeUnit.getMaxAddress());
		AddressIterator it = referenceManager.getReferenceSourceIterator(addresses, true);
		while (it.hasNext() && references.size() < max) {
			Address fromAddress = it.next();
			Reference[] refs = referenceManager.getReferencesFrom(fromAddress);
			for (Reference r : refs) {
				references.add(r);
			}
		}
		Collections.sort(references);
	}
Returns the number of comments that can be added before reaching the maximum number of
comments
@return the number of comments
Ghidra/Features/Base/src/main/java/ghidra/app/util/EolComments.java