Top Description Methods
com.google.j2objc.annotations

public @Interface AutoreleasePool

extends Annotation
Annotations
@Target:METHOD, LOCAL_VARIABLE
@Retention:SOURCE
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Annotation that indicates the translator should inject an autorelease pool around the method body. Only valid on methods that don't return anything.

Useful in high-level contexts to ensure that temporary objects allocated within the method or loop are deallocated.

Example usage:

// Temporary objects allocated during execution of this method will
// be deallocated upon returning from this method.
@AutoreleasePool
public void doWork() {
  ...
}

public void doWork(Iterable<Runnable> workToDo) {
  // Adding @AutoreleasePool on the loop variable causes a separate
  // autorelease pool to be attached to each loop iteration, clearing
  // up temporary objects after each iteration
  for (@AutoreleasePool Runnable item : workToDo) {
    item.run();
  }
}
Author
Pankaj Kakkar

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString