Methods Summary |
---|
public native void | gcSoftReferences()Requests that the virtual machine collect available memory,
and collects any SoftReferences that are not strongly-reachable.
|
public native long | getExternalBytesAllocated()Returns the number of externally-allocated bytes being tracked by
trackExternalAllocation/Free().
|
public long | getMinimumHeapSize()Returns the minimum heap size, or zero if no minimum is in effect.
return nativeMinimumHeapSize(0, false);
|
public static dalvik.system.VMRuntime | getRuntime()Returns the object that represents the VM instance's Dalvik-specific
runtime environment.
return THE_ONE;
|
public native float | getTargetHeapUtilization()Gets 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.
|
private native long | nativeMinimumHeapSize(long size, boolean set)If set is true, sets the new minimum heap size to size; always
returns the current (or previous) size.
|
private native void | nativeSetTargetHeapUtilization(float newTarget)Implements setTargetHeapUtilization().
|
public native void | runFinalizationSync()Does not return until any pending finalizers have been called.
This may or may not happen in the context of the calling thread.
No exceptions will escape.
|
public synchronized long | setMinimumHeapSize(long size)Sets the desired minimum heap size, and returns the
old minimum size. If size is larger than the maximum
size, the maximum size will be used. If size is zero
or negative, the minimum size constraint will be removed.
Synchronized to make the order of the exchange reliable.
return nativeMinimumHeapSize(size, true);
|
public float | setTargetHeapUtilization(float newTarget)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.
if (newTarget <= 0.0 || newTarget >= 1.0) {
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;
}
|
public native boolean | trackExternalAllocation(long size)Asks the VM if <size> bytes can be allocated in an external heap.
This information may be used to limit the amount of memory available
to Dalvik threads. Returns false if the VM would rather that the caller
did not allocate that much memory. If the call returns false, the VM
will not update its internal counts. May cause one or more GCs as a
side-effect.
Called by JNI code.
{@hide}
|
public native void | trackExternalFree(long size)Tells the VM that <size> bytes have been freed in an external
heap. This information may be used to control the amount of memory
available to Dalvik threads.
Called by JNI code.
{@hide}
|