Investigate if strong references between tasks can be avoided.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 268
- PR merge metrics
- No merged PRs in 30d
Description
The following example leads to OOM because of chain of references.
```
public class RetentionExample extends AbstractExample {
private Task last = null;
public static void main(String[] args) throws Exception {
new RetentionExample2().runExample();
}
@Override
protected void doRunExample(final Engine engine) throws Exception {
for (int i = 0; i < 1000000; i++) {
Task t = null;
if (last != null) {
t = last.andThen(Task.callable(() -> ""));
engine.run(t);
t.await();
} else {
t = Task.callable(() -> "");
}
last = t;
}
System.out.println(last.getTrace());
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the RetentionExample snippet, then trace how Task.andThen, Engine.run, await, and getTrace retain references during the million-iteration chain. Reproduce the OOM and inspect the task-chain lifecycle to determine whether strong references can be avoided; done means a documented conclusion or a verified change that prevents the demonstrated retention.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100