Using the client API I am trying to retrieve a 600MB file from BaseX. Version I am using is BaseX 8.3.
I have successfully stored this document using the client API without issue.
As an aside, I have update the basexserver script to include 4GB of memory as Java command line option. Here is the snippet from that script:# Options for virtual machine (can be extended by global options)
BASEX_JVM="-Xmx4g $BASEX_JVM"
In my Java client side application I have memory set to 3 GB of memory (script snippet below):exec "$JAVACMD" -Xms1g -Xmx3g .....rest of args.....
Here is a snippet of my Java code. Note that this works just fine when operation on smaller documents, but I wanted to stress test the code.
String query = "doc('theCollectionName/extract.xml')";ByteArrayOutputStream baos = new ByteArrayOutputStream();
ClientSession session = new ClientSession(host, port, user, pwd);session.setOutputStream(baos);ClientQuery cq = session.query(query);
cq.execute();
However, I keep getting out of memory with the below stack trace. I would think that the amount of space I am providing in both thebasexserver script (4GB) and my client side app (3GB) would be plenty to read in a 600MB file from BaseX. Is there something I am overlookingor something I am not doing correctly? Any insights/feedback is appreciated.
Exception in thread "queue" java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
at java.lang.StringCoding.decode(StringCoding.java:193)
at java.lang.StringCoding.decode(StringCoding.java:254)
at java.lang.String.<init>(String.java:534)
at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:221)
at org.basex.api.client.ClientSession.exec(ClientSession.java:261)
at org.basex.api.client.ClientQuery.execute(ClientQuery.java:102)