AutoreleasePool
Stay organized with collections
Save and categorize content based on your preferences.
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();
}
}
Inherited Method Summary
From interface
java.lang.annotation.Annotation
abstract
Class<? extends Annotation>
|
annotationType()
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
String
|
toString()
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-04-08 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]