fix memory leak
This commit is contained in:
parent
85e8a9e5b3
commit
37918aa27f
@ -61,7 +61,9 @@ public class SinglyLinkedList {
|
||||
throw new RuntimeException("The list is empty!");
|
||||
}
|
||||
|
||||
Node destroy = head;
|
||||
head = head.next;
|
||||
destroy = null; // clear to let GC do its work
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user