1550 MarkStackSize / K, MarkStackSizeMax / K); |
1550 MarkStackSize / K, MarkStackSizeMax / K); |
1551 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); |
1551 tty->print_cr("ConcGCThreads: %u", ConcGCThreads); |
1552 } |
1552 } |
1553 } |
1553 } |
1554 |
1554 |
|
1555 julong Arguments::limit_by_allocatable_memory(julong limit) { |
|
1556 julong max_allocatable; |
|
1557 julong result = limit; |
|
1558 if (os::has_allocatable_memory_limit(&max_allocatable)) { |
|
1559 result = MIN2(result, max_allocatable / MaxVirtMemFraction); |
|
1560 } |
|
1561 return result; |
|
1562 } |
|
1563 |
1555 void Arguments::set_heap_size() { |
1564 void Arguments::set_heap_size() { |
1556 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { |
1565 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { |
1557 // Deprecated flag |
1566 // Deprecated flag |
1558 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); |
1567 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); |
1559 } |
1568 } |
1588 // but it should be not less than default MaxHeapSize. |
1597 // but it should be not less than default MaxHeapSize. |
1589 max_coop_heap -= HeapBaseMinAddress; |
1598 max_coop_heap -= HeapBaseMinAddress; |
1590 } |
1599 } |
1591 reasonable_max = MIN2(reasonable_max, max_coop_heap); |
1600 reasonable_max = MIN2(reasonable_max, max_coop_heap); |
1592 } |
1601 } |
1593 reasonable_max = os::allocatable_physical_memory(reasonable_max); |
1602 reasonable_max = limit_by_allocatable_memory(reasonable_max); |
1594 |
1603 |
1595 if (!FLAG_IS_DEFAULT(InitialHeapSize)) { |
1604 if (!FLAG_IS_DEFAULT(InitialHeapSize)) { |
1596 // An initial heap size was specified on the command line, |
1605 // An initial heap size was specified on the command line, |
1597 // so be sure that the maximum size is consistent. Done |
1606 // so be sure that the maximum size is consistent. Done |
1598 // after call to allocatable_physical_memory because that |
1607 // after call to limit_by_allocatable_memory because that |
1599 // method might reduce the allocation size. |
1608 // method might reduce the allocation size. |
1600 reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); |
1609 reasonable_max = MAX2(reasonable_max, (julong)InitialHeapSize); |
1601 } |
1610 } |
1602 |
1611 |
1603 if (PrintGCDetails && Verbose) { |
1612 if (PrintGCDetails && Verbose) { |
1613 if (FLAG_IS_DEFAULT(InitialHeapSize)) { |
1622 if (FLAG_IS_DEFAULT(InitialHeapSize)) { |
1614 julong reasonable_minimum = (julong)(OldSize + NewSize); |
1623 julong reasonable_minimum = (julong)(OldSize + NewSize); |
1615 |
1624 |
1616 reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize); |
1625 reasonable_minimum = MIN2(reasonable_minimum, (julong)MaxHeapSize); |
1617 |
1626 |
1618 reasonable_minimum = os::allocatable_physical_memory(reasonable_minimum); |
1627 reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum); |
1619 |
1628 |
1620 julong reasonable_initial = phys_mem / InitialRAMFraction; |
1629 julong reasonable_initial = phys_mem / InitialRAMFraction; |
1621 |
1630 |
1622 reasonable_initial = MAX2(reasonable_initial, reasonable_minimum); |
1631 reasonable_initial = MAX2(reasonable_initial, reasonable_minimum); |
1623 reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); |
1632 reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); |
1624 |
1633 |
1625 reasonable_initial = os::allocatable_physical_memory(reasonable_initial); |
1634 reasonable_initial = limit_by_allocatable_memory(reasonable_initial); |
1626 |
1635 |
1627 if (PrintGCDetails && Verbose) { |
1636 if (PrintGCDetails && Verbose) { |
1628 // Cannot use gclog_or_tty yet. |
1637 // Cannot use gclog_or_tty yet. |
1629 tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial); |
1638 tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial); |
1630 tty->print_cr(" Minimum heap size " SIZE_FORMAT, (uintx)reasonable_minimum); |
1639 tty->print_cr(" Minimum heap size " SIZE_FORMAT, (uintx)reasonable_minimum); |
2606 // is turned on below, the actual space used may be smaller. |
2615 // is turned on below, the actual space used may be smaller. |
2607 |
2616 |
2608 initHeapSize = MIN2(total_memory / (julong)2, |
2617 initHeapSize = MIN2(total_memory / (julong)2, |
2609 total_memory - (julong)160*M); |
2618 total_memory - (julong)160*M); |
2610 |
2619 |
2611 // Make sure that if we have a lot of memory we cap the 32 bit |
2620 initHeapSize = limit_by_allocatable_memory(initHeapSize); |
2612 // process space. The 64bit VM version of this function is a nop. |
|
2613 initHeapSize = os::allocatable_physical_memory(initHeapSize); |
|
2614 |
2621 |
2615 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
2622 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
2616 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); |
2623 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); |
2617 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); |
2624 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); |
2618 // Currently the minimum size and the initial heap sizes are the same. |
2625 // Currently the minimum size and the initial heap sizes are the same. |