2

In my node.js application, I'm using JDBC to connect to a Oracle database. I need to increase my java heap space to prevent following error:

java.lang.OutOfMemoryError: Java heap space

I know that there is a terminal option for setting maximum Java heap size (-Xmx<size>) but the problem is, I don't explicitly run java, it happens inside my JDBC module (which depends on java module), so I can't use that terminal option.

So how java heap size can be configured in my case?

1
  • 1
    Have you tried: jinst.addOption("-Xmx1024"); ?
    – Valijon
    Jan 3, 2016 at 12:13

1 Answer 1

6

In short

I checked the source code of node-jdbc, and it's not possible at the moment.


In Detail

Refer the file jinst.js

var java = require('java');
...
module.exports = {
  ...
  addOption: function(option) {
    if (!isJvmCreated() && option) {
      java.options.push(option);
    } else if (isJvmCreated()) {
    ... 

Refer the files pool.js, connection.js, resultset.js

var jinst = require("./jinst");
...
var java = jinst.getInstance();
...
if (!jinst.isJvmCreated()) {
  jinst.addOption("-Xrs");
}

You will see it's only setting the option -Xrs even though the node module java is giving the flexibility of adding any java options.

Next Step

For the moment I'm not interested in this project. But If I was in your shoes I will create a pull request to the project https://github.com/CraZySacX/node-jdbc with this option as a feature.

Cheers :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.