I did some experimenting, and the rule of thumb seems to be this.
- For most Java setups, you can't exceed 2 GB, even if you have way more free RAM than that.
- You can't exceed the physical RAM you have.
- It doesn't appear that your current free memory matters, after all.
If these are the rules we can go by, then I can get a bit creative and address this pretty cleanly using the following:
- Default to 512 MB like today.
- Add a preferences entry for this with these choices
512 MB (default), 768 MB, 1 GB, 1.5 GB, 2 GB (maximum)
- If your computer has less than any of those choices, we don't show those options.
- If StencylWorks fails to launch, we need a way to reset it from outside. Hmm...
- If you hit the 90% error, recommend to the user to raise the memory limit if they're less than the max possible.