Queue.st
changeset 647 f937d30a8afc
parent 587 3edcd7c02966
child 686 d2daab8e8c8a
--- a/Queue.st	Wed May 20 15:30:30 1998 +0200
+++ b/Queue.st	Thu May 21 12:52:49 1998 +0200
@@ -170,6 +170,7 @@
     pos := readPosition.
 
     value := contentsArray at:pos.
+    contentsArray at:pos put:nil.       "/ to help the garbage collector
     pos := pos + 1.
     pos > contentsArray size ifTrue:[pos := 1].
     readPosition := pos.
@@ -211,6 +212,14 @@
     ^ contentsArray at:readPosition.
 !
 
+removeAll
+    "remove all elements in the queue"
+
+    tally := 0.
+    readPosition := writePosition := 1.
+    contentsArray atAllPut:nil          "/ to help the garbage collector
+!
+
 removeLast
     "return the last value in the queue; 
      Return nil, if the queue is empty"
@@ -227,6 +236,7 @@
     ].
 
     value := contentsArray at:pos.
+    contentsArray at:pos put:nil.       "/ to help the garbage collector
     writePosition := pos.
     tally := tally - 1.
     ^ value
@@ -295,5 +305,5 @@
 !Queue class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.20 1997-11-02 17:51:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Queue.st,v 1.21 1998-05-21 10:52:23 ca Exp $'
 ! !