/** * 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); }
/** * 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(); }
/** * 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()); }
/** * 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()); }
/** * 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; }
/** * 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(); }
/** * 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(); }