I've written a paralellized alghoritm to accomplish a calculation on data stored in a Orient table.
To take under control memory, I try to paginate these data and I try to parallelize my alghoritm about increase performance (using Future task).
My Orient settings are:
set ORIENTDB_SETTINGS=-Dprofiler.enabled=true -Dstorage.diskCache.bufferSize=12906
set JAVA_OPTS_SCRIPT=-Xmx4096M -Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -XX:PermSize=1024m
-XX:MaxPermSize=1024m
-Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
Xmx is fixed on 4 GB (4096MB as upper configuration), I've tried to monitor my Orient process with JVisualVM like the following screenshot:
On JVIsualVm process uses heap memory always under its limit, but in the Windows processes list the same process (I've highlighted the PID) occupies 7 GB and grows always.
Here my code:
for (Callable worker : workers) {
Future<Boolean> submit = executor.submit(worker);
futures.add(submit);
}
workers.clear();
workers = null;
boolean success = true;
for (Future<Boolean> future : futures) {
try {
if (Boolean.TRUE.equals(future.get())) {
[CODE BLOCK]
} else {
[CODE BLOCK FOR REPROCESS FUTURE]
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}