Recent. Use PowerShell scripts to configure Azure VMs (Virtual machine) in A7 (8 cores, 56G memory). Virtual machine) When running the Java JVM remotely (java.exe-version). Always fails and returns an error message such as the following.
The same PowerShell script. It is normal to run remotely on other VMs that are less than A7 configured, and assuming that you log on to the VM using Remote Desktop and do the same, everything works.
Error occurred during initialization of Vmunable to allocate 458752KB bitmaps for parallel garbage collection for the requ ested 14680064KB Heap. Error occurred during initialization of Vmcould not reserve enough space for object heap
The above experiment ruled out a problem with the JVM (1.7) itself. It seems that the problem is very likely to be the remote way of running PowerShell.
Powershell Remoting relies on winrm (Windows remote Management) to run operations on remote machines. By default, WinRM allocates a maximum (maxmemorypershellmb=1024) 1G of memory space for each PowerShell remote connection (earlier version numbers are only 150M) and is used to run remote operations.
However, when the operating memory space > 1G is required for remote operation, there is an out-of-memory problem, and different operations may behave differently, such as: some will throw outofmemoryexception and so on. In response to this problem. The workaround is to add MAXMEMORYPERSHELLMB and then restart the WinRM service:
$maxMemoryPerShellVM = 3072set-item WSMAN:\LOCALHOST\SHELL\MAXMEMORYPERSHELLMB $maxMemoryPerShellVMSet-item wsman:\ LOCALHOST\PLUGIN\MICROSOFT.POWERSHELL\QUOTAS\MAXMEMORYPERSHELLMB $maxMemoryPerShellVMWrite-output "List MAXMEMORYPERSHELLMB Configuration "Get-item wsman:\localhost\shell\maxmemorypershellmb get-item WSMan:\localhost\ PLUGIN\MICROSOFT.POWERSHELL\QUOTAS\MAXMEMORYPERSHELLMB # Restart WinRM service to make the change take Effectrestart-service WinRM
Details to add to how much memory, you need to experiment.
References Resources
Http://blog.patricknielsen.net/2012/01/powershell-remote-system-call-using.html
http://stackoverflow.com/questions/4741676/powershell-problem-running-java-remotely
PowerShell remote failed to execute Java JVM on Azure A7 virtual machine