forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev-java/icedtea: Patch CACAO for a dynamic maximum heap
It has been discovered that CACAO has been giving us memory problems because it had a fixed default heap size of only 128MB, whereas HotSpot uses a quarter of the physical RAM. I have patched CACAO to do the same. See IcedTea bugs gentoo#2611 and gentoo#2612. Package-Manager: portage-2.2.20.1
- Loading branch information
Showing
6 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- Makefile.in.orig 2015-07-28 07:21:16.447388803 -0700 | ||
+++ Makefile.in 2015-09-06 09:13:16.548000000 -0700 | ||
@@ -182,6 +182,7 @@ | ||
@WITH_RHINO_TRUE@ patches/rhino.patch | ||
|
||
@BUILD_CACAO_TRUE@am__append_22 = \ | ||
+@BUILD_CACAO_TRUE@ patches/cacao/dynmaxheap.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/launcher.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/memory.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/hotspot/original/memory.patch \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# HG changeset patch | ||
# User James Le Cuirot <[email protected]> | ||
# Date 1441543564 -3600 | ||
# Sun Sep 06 13:46:04 2015 +0100 | ||
# Node ID d0224f4490d6694e77dcb0ff7eae8e2297b822bf | ||
# Parent e215e36be9fc2b7dfe43ff10ec1afe639b289aa5 | ||
Dynamically set the maximum heap size on Linux | ||
|
||
diff -r e215e36be9fc -r d0224f4490d6 src/vm/vm.cpp | ||
--- cacao/cacao/src/vm/vm.cpp Mon Feb 11 19:31:28 2013 +0100 | ||
+++ cacao/cacao/src/vm/vm.cpp Sun Sep 06 13:46:04 2015 +0100 | ||
@@ -33,6 +33,10 @@ | ||
#include <errno.h> | ||
#include <stdlib.h> | ||
|
||
+#if defined(__LINUX__) | ||
+#include <unistd.h> | ||
+#endif | ||
+ | ||
#include "vm/types.h" | ||
|
||
#include "arch.h" | ||
@@ -702,6 +706,19 @@ | ||
opt_heapstartsize = HEAP_STARTSIZE; | ||
opt_stacksize = STACK_SIZE; | ||
|
||
+#if defined(__LINUX__) | ||
+ // Calculate 1/4 of the physical memory. | ||
+ uint64_t qmem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / 4; | ||
+ | ||
+ if (qmem > INT32_MAX) { | ||
+ // More than 2GB will overflow so cap it. | ||
+ opt_heapmaxsize = 2047 * 1024 * 1024; | ||
+ } else if (qmem > HEAP_MAXSIZE) { | ||
+ // Otherwise use this if greater than default (128MB). | ||
+ opt_heapmaxsize = (s4) qmem; | ||
+ } | ||
+#endif | ||
+ | ||
// First of all, parse the -XX options. | ||
|
||
#if defined(ENABLE_VMLOG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- Makefile.in.orig 2015-07-22 14:54:37.116940780 -0700 | ||
+++ Makefile.in 2015-09-06 05:05:47.220000000 -0700 | ||
@@ -134,6 +134,7 @@ | ||
@WITH_RHINO_TRUE@ patches/rhino.patch | ||
|
||
@BUILD_CACAO_TRUE@am__append_10 = \ | ||
+@BUILD_CACAO_TRUE@ patches/cacao/dynmaxheap.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/launcher.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/memory.patch \ | ||
@BUILD_CACAO_TRUE@ patches/cacao/armhf.patch \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# HG changeset patch | ||
# User James Le Cuirot <[email protected]> | ||
# Date 1441543564 -3600 | ||
# Sun Sep 06 13:46:04 2015 +0100 | ||
# Node ID d0224f4490d6694e77dcb0ff7eae8e2297b822bf | ||
# Parent e215e36be9fc2b7dfe43ff10ec1afe639b289aa5 | ||
Dynamically set the maximum heap size on Linux | ||
|
||
diff -r e215e36be9fc -r d0224f4490d6 src/vm/vm.cpp | ||
--- cacao/cacao/src/vm/vm.cpp Mon Feb 11 19:31:28 2013 +0100 | ||
+++ cacao/cacao/src/vm/vm.cpp Sun Sep 06 13:46:04 2015 +0100 | ||
@@ -33,6 +33,10 @@ | ||
#include <errno.h> | ||
#include <stdlib.h> | ||
|
||
+#if defined(__LINUX__) | ||
+#include <unistd.h> | ||
+#endif | ||
+ | ||
#include "vm/types.h" | ||
|
||
#include "arch.h" | ||
@@ -702,6 +706,19 @@ | ||
opt_heapstartsize = HEAP_STARTSIZE; | ||
opt_stacksize = STACK_SIZE; | ||
|
||
+#if defined(__LINUX__) | ||
+ // Calculate 1/4 of the physical memory. | ||
+ uint64_t qmem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / 4; | ||
+ | ||
+ if (qmem > INT32_MAX) { | ||
+ // More than 2GB will overflow so cap it. | ||
+ opt_heapmaxsize = 2047 * 1024 * 1024; | ||
+ } else if (qmem > HEAP_MAXSIZE) { | ||
+ // Otherwise use this if greater than default (128MB). | ||
+ opt_heapmaxsize = (s4) qmem; | ||
+ } | ||
+#endif | ||
+ | ||
// First of all, parse the -XX options. | ||
|
||
#if defined(ENABLE_VMLOG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters