开发者

"Could not create the Java virtual machine" caused by virus or machine is messed up?

"Could not create the Java virtual machine" caused by virus or machine is messed up?

I am using a dual core XP machine with 4GB memory installed (but only 2.5GB reported by the OS due to the 32bit fact). I am actively modifing an old JAVA application for at least a month by using lastest Eclipse (edit, build and run) and Ant (another way to build and run). In the Eclipse run configuration and build.xml file, we have the following JVM parameters: -Xmx1024M -Xms1024M -Xmn384M. We have been using this configuration for years.

I also have a batch file to launch Eclipse with this parameter: -vmargs -Xmx768M. This batch file has been with me for years. (now I changed to modify the eclipse.ini to do configuration.)

The day before yesterday, I found it was much slower when I used Ant to build and run my application (I build and run it frequently during the modification process). I restarted my machine just before I went home. That night I VPN to my machine to finish some modifications (I am a very good employee.) and found more slower. Next morning, "could not craete the Java Virtual Machine" started to happen when I run our application with Ant.

I restarted my machine. Then I couldn't start my Eclipse with the same error. I have to change the vmargs to claim only 512MB memory to launch the Eclipse. The build time with Ant increased from about 20开发者_如何学C seconds to about 6 minutes. And I have to decrease the max memory for JVM to

-Xmx512M -Xms512M

in both Eclipse run configuration and Ant build.xml in order to avoid error.

Then I uninstall my 1.6u24 jdk/jre and installed the 1.6u25. I reinstalled the Eclipse. Scanned the entire machine with Trend Micro and found nothing.

Another machine which I usually connect to do some testing has similar result (slower). All other machines, include my co-worker's machine and my laptop, work fine with the same application and tools.

If I use Ant to build and run it, the build process and launch process are extramely slow. I have created two batch files to compile and launch my application . They work as normal. When compile with Eclipse, it works as normal. But I cannot ask JVM to claim 1024MB for my application in all cases now.

All other activities on my machine seem normal. VisualStudio and C# application work as usual. My machine was rebuilt few weeks ago due to hard disk failure. So there are no many useless things to slow my machine down.

Anybody can help me figure out why the JVM on my machine changed its behaviour? I hope it is not caused by virus. Do you know anything I can try before I call IT to rebuild my machine?

thanks,


While your configuration might not have changed, that doesn't mean that the amount of available memory hasn't changed. Memory is used by all programs in the operating system, so if another program has a slightly larger use of memory, it might not be possible to pre-assign the 1GB of memory you indicated (from the command line arguments) must be available to start the JVM.

Another possibility is that some new program is installed / running, and it is absconding with the memory you need. Virus scanning might have been installed / updated, and it alone can be quite a memory hog (depending on the product).

Finally, you mentioned that the machine was rebuilt. You might want to verify (via BIOS) that you actually have the same amount of physical memory you had prior to the rebuild. Rebuilding machines has a funny way of jarring memory sticks out of their sockets (or perhaps there was more rebuilding going on than meets the eye). The issue could be as simple as there's not enough memory to pre-assign to the JVM because you are starting with less.

If all of that checks out, check the obscure stuff. If you reinstalled a very old or different operating system, it might not support accessing as much memory as is installed. This commonly occurs when someone is reverted from a 64 bit installation down to a 32 bit installation.


Either use the task manager or process explorer from microsoft (http://technet.microsoft.com/en-us/sysinternals/bb896653) and check for memory hogs. If you have to reduce the amount of memory you are using, chances are it is because something else has taken it up. Also, I find the cap at 2.5GB a bit odd, as I thought the cap was more like 3.25GB (mostly because this is what I have on my windows XP with 4gb installed).

Also, every time I've seen that error message it is because there isn't enough physical memory available to grab. I've had to close programs in the past in order to run a few things after getting this exception.

(I would have put this in a comment, but don't have the rating yet :/ )


Can you see anything odd in the task manager? CPU utilization? The fact that you can't allocate as much memory as you used to sounds odd, but I have seen similar decrease in compilation times after an upgrade of the antivirus on one of my development machines.

What happens if you disable antivirus while you do a compilation?


It sounds more like a configuration issue than a virus, especially considering that it was rebuilt recently. You didn't mention whether you are using 32-bit or 64-bit Java. It might help to know which one is trying to run when it fails.

Other things to check: virtual memory settings; any application-specific settings in the OS; anti-virus program settings; other processes (try running HijackThis and/or MSRT).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜