Java Code Examples for android.os.Debug#startAllocCounting()

The following examples show how to use android.os.Debug#startAllocCounting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Deprecated
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 2
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 3
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Deprecated
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 4
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Deprecated
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 5
Source File: Instrumentation.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Deprecated
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 6
Source File: Instrumentation.java    From droidel with Apache License 2.0 5 votes vote down vote up
public void startAllocCounting() {
    // Before we start trigger a GC and reset the debug counts. Run the 
    // finalizers and another GC before starting and stopping the alloc
    // counts. This will free up any objects that were just sitting around 
    // waiting for their finalizers to be run.
    Runtime.getRuntime().gc();
    Runtime.getRuntime().runFinalization();
    Runtime.getRuntime().gc();

    Debug.resetAllCounts();
    
    // start the counts
    Debug.startAllocCounting();
}
 
Example 7
Source File: BenchmarkStats.java    From ig-json-parser with MIT License 5 votes vote down vote up
/** Grabs the pre-snapshot. Forces a {@link System#gc()} before collecting stats. */
synchronized void before() {
  if (mState != State.INIT) {
    throw new IllegalStateException("unexpected state");
  }

  mState = State.BEFORE_CALLED;
  System.gc();
  Debug.getMemoryInfo(mMemoryInfoBefore);
  Debug.startAllocCounting();
  mBeforeTimestamp = SystemClock.elapsedRealtime();
}
 
Example 8
Source File: HeapStatsLogger.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private HeapStatsLogger(Context context) {
    Debug.startAllocCounting();
    mBroadcastReceiver = new HeapStatsLoggerReceiver();
    mIntentFilter = new HeapStatsLoggerIntentFilter();
    context.registerReceiver(mBroadcastReceiver, mIntentFilter);
}
 
Example 9
Source File: HeapStatsLogger.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private HeapStatsLogger(Context context) {
    Debug.startAllocCounting();
    mBroadcastReceiver = new HeapStatsLoggerReceiver();
    mIntentFilter = new HeapStatsLoggerIntentFilter();
    context.registerReceiver(mBroadcastReceiver, mIntentFilter);
}