Hi list,
I have developed a jena-based application, which has a TDB back-end which loads
a owl file with some good number of triples. All using the Jena API.
I have done some testing (1000 queries every second), and I get a memory leak
on com.hp.jena.graph.Node_Literal.
The stack is as follows
Currently 470 leaked objects exist of class
com.hp.hpl.jena.graph.Node_Literal
The objects are created at
com.hp.hpl.jena.graph.Node$2.construct(java.lang.Object):238
and are being held
in nodes of com.hp.hpl.jena.graph.NodeCache
in present of com.hp.hpl.jena.graph.Node
in elementData of java.util.Vector
in classes of sun.misc.Launcher$AppClassLoader
The leak is not that huge (101K of the total available 77M heap), but it is a
leak. It starts to show up half-way through the testing session. So I am
assuming that a leaked object is created every time a query is executed. The
query is being done in the following fn:
public static String printSelectQueryAsJSON(Model model, String queryString)
throws QueryExecException, QueryParseException, IOException,
ConcurrentModificationException {
String queryResults = null;
Query query = QueryFactory.create(queryString, Syntax.syntaxARQ);
if (!query.isSelectType()) {
throw new QueryExecException("Attempt to execute a SELECT query
from a " + QueryEngineUtils.labelForQuery(query) + " query");
}
QueryExecution qexec = QueryExecutionFactory.create(query, model);
//qexec.getContext().set(TDB.symLogExec, Explain.InfoLevel.FINE);
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ResultSet results;
results = qexec.execSelect();
ResultSetFormatter.outputAsJSON(out, results);
queryResults = out.toString();
} finally {
qexec.close();
out.flush();
}
long epoch_ends = System.currentTimeMillis();
logger.debug("QET (" + lQueryId + "): " + (epoch_ends - epoch_starts));
return queryResults;
}
For extra info, the set of libraries I am using is:
Jena 2.6.4
ARQ-2.8.8
TDB-0.8.10
Any idea where I should start looking to solve this memory leak will be useful.
Thanks in advance,
Emilio