Java maximum memory on Windows XP

前端 未结 13 1788
轻奢々
轻奢々 2020-11-22 09:27

I\'ve always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6).

java -Xmx1400m ...

Toda

相关标签:
13条回答
  • 2020-11-22 09:53

    First, using a page-file when you have 4 GB of RAM is useless. Windows can't access more than 4GB (actually, less because of memory holes) so the page file is not used.

    Second, the address space is split in 2, half for kernel, half for user mode. If you need more RAM for your applications use the /3GB option in boot.ini (make sure java.exe is marked as "large address aware" (google for more info).

    Third, I think you can't allocate the full 2 GB of address space because java wastes some memory internally (for threads, JIT compiler, VM initialization, etc). Use the /3GB switch for more.

    0 讨论(0)
  • 2020-11-22 09:54

    Keep in mind that Windows has virtual memory management and the JVM only needs memory that is contiguous in its address space. So, other programs running on the system shouldn't necessarily impact your heap size. What will get in your way are DLL's that get loaded in to your address space. Unfortunately optimizations in Windows that minimize the relocation of DLL's during linking make it more likely you'll have a fragmented address space. Things that are likely to cut in to your address space aside from the usual stuff include security software, CBT software, spyware and other forms of malware. Likely causes of the variances are different security patches, C runtime versions, etc. Device drivers and other kernel bits have their own address space (the other 2GB of the 4GB 32-bit space).

    You could try going through your DLL bindings in your JVM process and look at trying to rebase your DLL's in to a more compact address space. Not fun, but if you are desperate...

    Alternatively, you can just switch to 64-bit Windows and a 64-bit JVM. Despite what others have suggested, while it will chew up more RAM, you will have much more contiguous virtual address space, and allocating 2GB contiguously would be trivial.

    0 讨论(0)
  • 2020-11-22 09:54

    This has to do with contiguous memory.

    Here's some info I found online for somebody asking that before, supposedly from a "VM god":

    The reason we need a contiguous memory region for the heap is that we have a bunch of side data structures that are indexed by (scaled) offsets from the start of the heap. For example, we track object reference updates with a "card mark array" that has one byte for each 512 bytes of heap. When we store a reference in the heap we have to mark the corresponding byte in the card mark array. We right shift the destination address of the store and use that to index the card mark array. Fun addressing arithmetic games you can't do in Java that you get to (have to :-) play in C++.

    Usually we don't have trouble getting modest contiguous regions (up to about 1.5GB on Windohs, up to about 3.8GB on Solaris. YMMV.). On Windohs, the problem is mostly that there are some libraries that get loaded before the JVM starts up that break up the address space. Using the /3GB switch won't rebase those libraries, so they are still a problem for us.

    We know how to make chunked heaps, but there would be some overhead to using them. We have more requests for faster storage management than we do for larger heaps in the 32-bit JVM. If you really want large heaps, switch to the 64-bit JVM. We still need contiguous memory, but it's much easier to get in a 64-bit address space.

    0 讨论(0)
  • 2020-11-22 09:55

    Here is how to increase the Paging size

    1. right click on mycomputer--->properties--->Advanced
    2. in the performance section click settings
    3. click Advanced tab
    4. in Virtual memory section, click change. It will show ur current paging size.
    5. Select Drive where HDD space is available.
    6. Provide initial size and max size ...e.g. initial size 0 MB and max size 4000 MB. (As much as you will require)
    0 讨论(0)
  • 2020-11-22 09:57

    The Java heap size limits for Windows are:

    • maximum possible heap size on 32-bit Java: 1.8 GB
    • recommended heap size limit on 32-bit Java: 1.5 GB (or 1.8 GB with /3GB option)

    This doesn't help you getting a bigger Java heap, but now you know you can't go beyond these values.

    0 讨论(0)
  • 2020-11-22 10:00

    **There are numerous ways to change heap size like,

    1. file->setting->build, exceution, deployment->compiler here you will find heap size
    2. file->setting->build, exceution, deployment->compiler->andriod here also you will find heap size. You can refer this for andriod project if you facing same issue.

    What worked for me was

    1. Set proper appropriate JAVA_HOME path incase you java got updated.

    2. create new system variable computer->properties->advanced setting->create new system variable

    name: _JAVA_OPTION value: -Xmx750m

    FYI: you can find default VMoption in Intellij help->edit custom VM option , In this file you see min and max size of heap.**

    0 讨论(0)
提交回复
热议问题