2

I have java options set to -Xms1024M inside environment variables. I am using windows 7 as the operating system. However if i try to run any java program i get error Could not reserve enough space for 1048576KB object Heap

I checked my RAM usage and i see that there is plenty of memory available. Resource monitor shows below stats:

Hardware reserved:207 MB In Use:5855 MB Modified:44 MB Standby:7849 MB Free:2276 MB


Available:10139 MB Cached:7908 MB Total:16177 MB Installed: 16384 MB

Can anyone help how this can be resolved and explain how exactly allocation works with respect to RAM. I believe that as memory is available, there should be some way to allocated it

Chetan
  • 4,735
  • 8
  • 48
  • 57
  • 1
    Which java version are you using 32 bit or 64 bit? Also, let me know your RAM size. – NullPointer Jun 21 '18 at 14:28
  • One more point, I can see you have used -Xms. Xms specifies the initial memory allocation pool. Please use -Xmx. Please follow below link for more details: https://stackoverflow.com/questions/14763079/what-are-the-xms-and-xmx-parameters-when-starting-jvms – NullPointer Jun 21 '18 at 14:33
  • Iam using java 1.8 – Chetan Jun 21 '18 at 14:55
  • Have you tried with -Xmx instead of -Xms? Run -XMx with more than 1024M since 1024M=1024000KB and looks like you application need more than 1024000KB . – NullPointer Jun 21 '18 at 14:57
  • I have tried with xmx too – Chetan Jun 21 '18 at 15:12
  • I hope you have used first 'X' in uppercase. Are you getting the same error ? Have you tried with increasing the heap size for instance 1024M to 2048M ? – NullPointer Jun 21 '18 at 15:18
  • Yes I used X and tried all 1024, 2048.. I was only successful for 512 – Chetan Jun 21 '18 at 16:06
  • Great so it is working now. If my comments helped you let me know if I can add it in answer. You can accept it so It will allow other users to see it. – NullPointer Jun 21 '18 at 16:10

0 Answers0