3

I'm using a java application which requires a lot of memory, and I'd like to be able to set the maximum available memory for the JVM to a value above 4096MB, such as 8192MB.

I tried using the following parameter:

wrapper.java.maxmemory

which seems to work fine under the 4096MB threshold, but not above (it is stuck at something like 3.7GB or so).

I'm using a 64b JVM.

Where is the piece of code that prevents me from going above 4096MB?

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
slebyc
  • 33
  • 1
  • 4

1 Answers1

4

unfortunaly, the limit of wrapper.java.maxmemory is hardcoded in the version used in Karaf (wrapper.c, v3.2.3) :

/* Maximum JVM memory */
maxMemory = getIntProperty(properties, "wrapper.java.maxmemory", 0);
if (maxMemory > 0) {
    maxMemory = __min(__max(maxMemory, initMemory), 4096);  /* initMemory <= n <= 4096 */
    if (strings) {
        strings[index] = malloc(sizeof(char) * (5 + 4 + 1));  /* Allow up to 4 digits. */
        sprintf(strings[index], "-Xmx%dm", maxMemory);
    }
    index++;
}

You should use something like wrapper.java.additional.1 = -Xmx8196m

Jérémie B
  • 10,611
  • 1
  • 26
  • 43
  • I cannot find this file in sources of karaf (wrapper.c), where is file located, what project? I am looking on mirror on github (official), thx. – kensai Apr 12 '17 at 17:24
  • The "wrapper" is not related to karaf. You can find the project here : https://wrapper.tanukisoftware.com/doc/english/download.jsp I don't think the sources are on github. – Jérémie B Apr 13 '17 at 19:04
  • Ahh, I see thanks, otherwise using additional.n works – kensai Apr 15 '17 at 17:07