fix memory leak

This commit is contained in:
shellhub 2019-09-24 20:19:50 +08:00
parent 85e8a9e5b3
commit 37918aa27f

View File

@ -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
}
/**