slebyc
slebyc

Reputation: 43

Setting a heap memory above 4096MB on Karaf

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?

Upvotes: 4

Views: 3190

Answers (1)

Jérémie B
Jérémie B

Reputation: 11032

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

Upvotes: 5

Related Questions