mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 03:59:38 +08:00
fix memory leak
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user