Skip to content

Commit

Permalink
[fix](Nereids): avoid memory usage due to multiple iterations when el…
Browse files Browse the repository at this point in the history
…iminate func deps (apache#35408)
  • Loading branch information
keanji-x authored and seawinde committed May 27, 2024
1 parent c8b7b55 commit 7174a38
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ public Set<Set<Slot>> eliminateDeps(Set<Set<Slot>> slots) {
Set<Set<Slot>> minSlotSet = slots;
List<Set<Set<Slot>>> reduceSlotSets = new ArrayList<>();
reduceSlotSets.add(slots);
while (!reduceSlotSets.isEmpty()) {
// To avoid memory usage due to multiple iterations,
// we set a maximum number of loop iterations.
int count = 0;
while (!reduceSlotSets.isEmpty() && count < 100) {
count += 1;
List<Set<Set<Slot>>> newReduceSlotSets = new ArrayList<>();
for (Set<Set<Slot>> slotSet : reduceSlotSets) {
for (FuncDepsItem funcDepsItem : items) {
Expand Down

0 comments on commit 7174a38

Please sign in to comment.