Skip to content

Commit

Permalink
Merge pull request #2642 from zsxwing/fix-memory-leak
Browse files Browse the repository at this point in the history
Fix a potential memory leak in schedulePeriodically
  • Loading branch information
akarnokd committed Feb 10, 2015
2 parents 68f7f66 + 9f590cf commit d1034ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/rx/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public void call() {
}
}
};
mas.set(schedule(recursiveAction, initialDelay, unit));
MultipleAssignmentSubscription s = new MultipleAssignmentSubscription();
// Should call `mas.set` before `schedule`, or the new Subscription may replace the old one.
mas.set(s);
s.set(schedule(recursiveAction, initialDelay, unit));
return mas;
}

Expand Down

0 comments on commit d1034ed

Please sign in to comment.