]> scripts.mit.edu Git - www/raw.git/blob - news/102.mdwn
Import from TextPattern
[www/raw.git] / news / 102.mdwn
1 [[!meta title="Java no longer broken on scripts.mit.edu"]]
2 Yesterday it was brought to our attention that our resource limits
3 were preventing Java from working, because the JVM attempted to
4 allocate more memory than our limits.
5
6 Because of problems in the past with Java instances using 2 GB or
7 more memory causing out-of-memory conditions, we recently
8 reimplemented a 1 GB per-process [resource limit](/faq/34/).
9 However, the Java startup code’s attempt at allocating a
10 “reasonable fraction” of the total physical memory on the server
11 makes it attempt to grab about 1.05 GB. (This is a
12 [known issue](http://bugs.sun.com/view_bug.do?bug_id=6374896) in
13 Java.) This amount might be reasonable for a server running nothing
14 but Java, but is entirely too much for a shared host like
15 scripts.mit.edu. So, we’re setting the JAVA\_TOOL\_OPTIONS=-Xmx128M
16 environment variable to limit the maximum Java heap size, and Java
17 should be working again.
18
19 If this isn’t enough for your application, you can create a
20 **.hotspotrc** file in the same directory as your script or Java
21 code, containing the option **MaxHeapSize=256M** (or possibly 512M;
22 note that we’ve tested 768M and found it to be unstable), or you
23 can pass **-Xmx256M** on your Java command line.
24
25 It looks like we don’t have very many Java users at all because
26 this problem went unreported, but if you have any questions, as
27 always, please let us know at
28 [scripts@mit.edu](mailto:scripts@mit.edu).
29
30
31