int percent = (int) (run.freeMemory() / (run.totalMemory() / 100)); if (percent < memMinFree) {
final int percent = (int) (run.freeMemory() / (run.totalMemory() / 100)); if (nodesCount > MEM_LIMIT_CHECK && percent < memMinFree) {
	public void store(final NodeImpl node, String currentPath) {		final IndexPaths idx =			(IndexPaths) config.getProperty(				"indexScheme."					+ node.getOwnerDocument().getDoctype().getName());        final long gid = node.getGID();		if (gid < 0)			LOG.debug(				"illegal node: " + gid + "; " + node.getNodeName());		final short nodeType = node.getNodeType();		final String nodeName = node.getNodeName();		final DocumentImpl doc = (DocumentImpl) node.getOwnerDocument();		final int depth = idx == null ? defaultIndexDepth : idx.getIndexDepth();		final byte data[] = node.serialize();		new DOMTransaction(this, domDb, Lock.WRITE_LOCK) {			public Object start() throws ReadOnlyException {				long address = -1;				if (nodeType == Node.TEXT_NODE					|| nodeType == Node.ATTRIBUTE_NODE					|| doc.getTreeLevel(gid) > depth)					address = domDb.add(data);				else {					address = domDb.put(new NodeRef(doc.getDocId(), gid), data);				}				node.setInternalAddress(address);				return null;			}		}		.run();		NodeProxy tempProxy =			new NodeProxy(doc, gid, node.getInternalAddress());		switch (nodeType) {			case Node.ELEMENT_NODE :				// save element by calling ElementIndex				elementIndex.setDocument(doc);				elementIndex.addRow(nodeName, tempProxy);				break;			case Node.ATTRIBUTE_NODE :				elementIndex.setDocument(doc);				elementIndex.addRow("@" + nodeName, tempProxy);				// check if attribute value should be fulltext-indexed				// by calling IndexPaths.match(path) 				if (idx == null					|| (idx.getIncludeAttributes()						&& idx.match(currentPath + "/@" + nodeName)))					textEngine.storeAttribute(idx, (AttrImpl) node);				// if the attribute has type ID, store the ID-value				// to the element index as well				if (((AttrImpl) node).getType() == AttrImpl.ID) {					LOG.debug("storing ID");					elementIndex.addRow(						"&" + ((AttrImpl) node).getValue(),						tempProxy);				}				break;			case Node.TEXT_NODE :				// check if this textual content should be fulltext-indexed				// by calling IndexPaths.match(path)				if (idx == null || idx.match(currentPath))					textEngine.storeText(idx, (TextImpl) node);				break;		}		int percent = (int) (run.freeMemory() / (run.totalMemory() / 100));		if (percent < memMinFree) {			LOG.info(				"total memory: "					+ run.totalMemory()					+ "; free: "					+ run.freeMemory());			flush();			System.gc();			LOG.info(				"total memory: "					+ run.totalMemory()					+ "; free: "					+ run.freeMemory());		}	}