# Is there a way to know how much Java heap space to set?

I have already set it to be 4GB.

Needs["JLink"]
ReinstallJava[JVMArguments -> "-Xmx4096m"]


However, when exporting a dataset to Excel sheet, I still get the following:

Very frsutrating after a long wait and still getting this error. My laptop does have 32G of RAM. But is there a way to figure out how much to set in advance (instead of setting to the limit)?

Thanks.

• Hard to say without ans. – Kuba Nov 3 '17 at 6:43
• At the very least, what does ByteCount[Prepend[ans, Range[85]]] return? – J. M. will be back soon Nov 3 '17 at 6:55
• @J.M. Wow, it's 519284064. No idea it's that big! – Chen Stats Yu Nov 3 '17 at 14:47
• Then, can you try setting to 8 GB (ReinstallJava[JVMArguments -> "-Xmx8192m"]`)? – J. M. will be back soon Nov 3 '17 at 14:50
• If you do not mind using NETLink (which seems way more efficient than JLink in the case of exporting large Excel files), try my bigExport function posted here: community.wolfram.com/groups/-/m/t/1163363 – Rolf Mertig Nov 3 '17 at 22:46