Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(grunt): reduce JVM heap size hint on win #4831

Closed
wants to merge 1 commit into from

Conversation

tathamoddie
Copy link
Contributor

The current grunt scripts set the maximum JVM heap space to 2GB. While this is only a maximum, and not an initial, it is preventing the JVM from even initializing on a number of people's machines. The build still runs successfully for me locally using only 512MB for this setting. See issue #4595 for reported instances.

Closes #4595

The current grunt scripts require at least 2GB of heap space to be
allocated by the JVM, even though this is not needed to actually complete
the build. Adding 64-bit to the mix, this means grunt package fails on
machines without a whole 4GB of RAM free.

Closes angular#4595
@petebacondarwin
Copy link
Contributor

This was originally added because Travis kept falling over on builds. -Xmx (rather than -Xms) is "maximum" heap space not "initial". See http://docs.oracle.com/cd/E22289_01/html/821-1274/configuring-the-default-jvm-and-java-arguments.html. So this should not cause java to allocate 2Gb.

That being said, the way different java compilers treat such flags is a bit unspecified.

Before we can change this we need to ascertain exactly what is the minimum required. Is 512Mb enough? I have a feeling it may not always be.

@benlesh
Copy link
Contributor

benlesh commented Nov 8, 2013

As the Issue I submitted states, I had to do this in order to get Angular to build successfully on my machine. Which is running Windows 7 64-bit with 16GB of RAM. It might be that I only have the 32bit version of the JVM installed locally... I'm not really a JVM memory allocation expert.

Perhaps we need some sort of conditional check in the build scripts to switch that flag out under certain circumstances?

@benlesh
Copy link
Contributor

benlesh commented Nov 8, 2013

To be clear... it wasn't a memory shortage that was causing the failure I was seeing... it was the JVM failing to even initialize.

@tathamoddie
Copy link
Contributor Author

Same as @Blesh here: the JVM wouldn't initialize on my machine even with 3.9GB of free RAM. I'm using the 32-bit JVM, however it should support settings up to 4GB based on the Oracle doco.

@petebacondarwin
Copy link
Contributor

@Blesh - is this still a problem for you?

@benlesh
Copy link
Contributor

benlesh commented Nov 14, 2014

@petebacondarwin No, I have a mac now. ;) Haha. The referenced PR should be enough of a workaround for anyone else that runs into this I would think.

@Narretz
Copy link
Contributor

Narretz commented Mar 26, 2015

I'd actually like to see if we can work with the smaller max size. I've seen this on two different Windows machines, one aborts during minify, ther other flat out refuses to start; reducing to 1024m makes it work.

@Bit-Rot
Copy link

Bit-Rot commented Apr 13, 2015

For what it's worth, I'm reproducing this issue as well. Changing java args to -Xmx1g instead of -Xmx2g served as a workaround.

@petebacondarwin petebacondarwin modified the milestones: 1.4.0-rc.1, Backlog Apr 13, 2015
@caitp
Copy link
Contributor

caitp commented Apr 17, 2015

this is probably safe to land --- although if I had my way we'd just get rid of closure entirely. @Bit-Rot what do you think, is 1g a safer bet than 512m?

@Bit-Rot
Copy link

Bit-Rot commented Apr 17, 2015

1G seems like a more conservative adjustment from 2G, and safer in that regard. I'm not, however, well informed on closure's memory requirements; I'm just just shooting in the dark here.

@chirayuk chirayuk removed this from the 1.4.0-rc.1 milestone Apr 24, 2015
@chirayuk chirayuk modified the milestones: 1.4.0-rc.2, 1.4.0-rc.1 Apr 24, 2015
@petebacondarwin
Copy link
Contributor

Let's go with 1G for now and see how it runs.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this pull request Apr 29, 2015
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.