Ejemplo n.º 1
0
  /**
   * This method controls the triggering of a GC. It is called periodically during allocation.
   * Returns true to trigger a collection.
   *
   * @param spaceFull Space request failed, must recover pages within 'space'.
   * @return True if a collection is requested by the plan.
   */
  public final boolean collectionRequired(boolean spaceFull) {
    int nurseryPages = nurserySpace.reservedPages();

    if (nurseryPages > Options.nurserySize.getMaxNursery()) {
      return true;
    }

    if (virtualMemoryExhausted()) return true;

    return super.collectionRequired(spaceFull);
  }
  /**
   * This method controls the triggering of a GC. It is called periodically during allocation.
   * Returns true to trigger a collection.
   *
   * @param spaceFull Space request failed, must recover pages within 'space'.
   * @return True if a collection is requested by the plan.
   */
  public final boolean collectionRequired(boolean spaceFull, Space space) {
    int nurseryPages = nurserySpace.reservedPages();

    if (nurseryPages > Options.nurserySize.getMaxNursery()) {
      return true;
    }

    if (virtualMemoryExhausted()) {
      return true;
    }

    if (spaceFull && space != nurserySpace) {
      nextGCFullHeap = true;
    }

    return super.collectionRequired(spaceFull, space);
  }
Ejemplo n.º 3
0
 /**
  * Return the number of pages reserved for copying.
  *
  * @return The number of pages reserved given the pending allocation, including space reserved for
  *     copying.
  */
 @Override
 public int getCollectionReserve() {
   return nurserySpace.reservedPages() + super.getCollectionReserve();
 }
Ejemplo n.º 4
0
 /**
  * Return the number of pages in use given the pending allocation. Simply add the nursery's
  * contribution to that of the superclass.
  *
  * @return The number of pages reserved given the pending allocation, excluding space reserved for
  *     copying.
  */
 @Override
 public int getPagesUsed() {
   return (nurserySpace.reservedPages() + super.getPagesUsed());
 }
Ejemplo n.º 5
0
 /**
  * Independent of how many pages remain in the page budget (a function of heap size), we must
  * ensure we never exhaust virtual memory. Therefore we must never let the nursery grow to the
  * extent that it can't be copied into the mature space.
  *
  * @return True if the nursery has grown to the extent that it may not be able to be copied into
  *     the mature space.
  */
 private boolean virtualMemoryExhausted() {
   return ((int) (nurserySpace.reservedPages() * WORST_CASE_COPY_EXPANSION)
       >= getMaturePhysicalPagesAvail());
 }
Ejemplo n.º 6
0
  /**
   * This method controls the triggering of a GC. It is called periodically during allocation.
   * Returns true to trigger a collection.
   *
   * @param spaceFull Space request failed, must recover pages within 'space'.
   * @return True if a collection is requested by the plan.
   */
  public final boolean collectionRequired(boolean spaceFull) {
    boolean nurseryFull = nurserySpace.reservedPages() > Options.nurserySize.getMaxNursery();

    return super.collectionRequired(spaceFull) || nurseryFull;
  }
Ejemplo n.º 7
0
 /**
  * Return the number of pages in use given the pending allocation. Simply add the nursery's
  * contribution to that of the superclass.
  *
  * @return The number of pages reserved given the pending allocation, excluding space reserved for
  *     copying.
  */
 public final int getPagesUsed() {
   return super.getPagesUsed() + nurserySpace.reservedPages();
 }
Ejemplo n.º 8
0
 /**
  * Return the number of pages reserved for copying.
  *
  * @return The number of pages reserved given the pending allocation, including space reserved for
  *     copying.
  */
 public final int getCollectionReserve() {
   return nurserySpace.reservedPages() + super.getCollectionReserve();
 }