How to adjust Java heap size for node.js JDBC module?

In my node.js application, I use JDBC to connect to an Oracle database. I need to increase java heap space to prevent the following error:

java.lang.OutOfMemoryError: Java heap space

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

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

+4
source share
1 answer

In short

node-jdbc, .


jinst.js

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

pool.js, connection.js, resultset.js

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

, -Xrs, java node java.

. , https://github.com/CraZySacX/node-jdbc .

:)

+6

Source: https://habr.com/ru/post/1622589/


All Articles