/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
long newsize = 4 * 1024 * 1024; bibleHelper.showErrorLog(" the New Size-->" + newsize); VMRuntime heap = VMRuntime.getRuntime(); bibleHelper.showErrorLog("cur Alocate -->"+ heap.getTargetHeapUtilization()); long oldSize = heap.setMinimumHeapSize(newsize); bibleHelper.showErrorLog("After New Size -->"+ heap.getTargetHeapUtilization());
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }
/** * Sets the current ideal heap utilization, represented as a number * between zero and one. After a GC happens, the Dalvik heap may * be resized so that (size of live objects) / (size of heap) is * equal to this number. * * <p>This is only a hint to the garbage collector and may be ignored. * * @param newTarget the new suggested ideal heap utilization. * This value may be adjusted internally. * @return the previous ideal heap utilization * @throws IllegalArgumentException if newTarget is <= 0.0 or >= 1.0 */ public float setTargetHeapUtilization(float newTarget) { if (newTarget <= 0.0f || newTarget >= 1.0f) { throw new IllegalArgumentException(newTarget + " out of range (0,1)"); } /* Synchronize to make sure that only one thread gets * a given "old" value if both update at the same time. * Allows for reliable save-and-restore semantics. */ synchronized (this) { float oldTarget = getTargetHeapUtilization(); nativeSetTargetHeapUtilization(newTarget); return oldTarget; } }