As long as no item in the queue is referenced anywhere else in your code, the garbage collector will be able to reclaim that memory. Setting pointers to null in Java is not the same as in C where setting a malloc'ed pointer to null prevents it from being freed. In Java, memory is reclaimed when it is no longer reachable. There are no memory leaks in Java (in the C/C++ sense), as long as you're not using native code via JNI.
A simplistic garbage collector would just count the number of references to an object and deallocate that object when the reference count reached zero, but that wouldn't be able to deal with reference cycles (A -> B, A -> B -> C -> A, etc.). The Java GC algorithms do a liveness test, where they construct a reference graph of all objects in the system. The GC does a graph traversal and any nodes (objects) that are not reachable are marked as unused and available for reallocation. The roots of the graph (starting ponts of the traversal) include variables on thread stacks, static variables, and references held by native code via JNI. See more here: http://java.sun.com/developer/Books/performance/performance2/appendixa.pdf
It is still possible to have reference leaks. This refers to situations where you're holding on to a reference to an object longer than is needed. For example:
public class Stack {
private final Object[] stack = new Object[10];
private int top = 0;
public void push(Object obj) {stack[top++] = obj;}
public Object pop() {return stack[top--]; }
}
Ignoring the overflow/underflow possibility, after you call Stack.pop(), the array member variable still has a reference to the object that was returned. It will prevent that object from being garbage collected until the surrounding Stack instance is no longer referenced. This is one of the rare instances where it is necessary to set a variable to null so that its memory can be reclaimed:
public Object pop() {Object ret = stack[top]; stack[top--] = null; return ret;}