I understand that when a directbytebuffer is allocated, its not subject to garbage collection, but what I\'m wondering is if the wrapping object is garbage collecte
Looking at the source code to DirectByteBuffer it just returns a new instance, so no, you won't OOM yourself.
As long as the rest of your code doesn't hold onto a reference to the original dbb then that object will get garbage collected as normal. The extra dbb2 objects will similarly get garbage collected when there is no longer any reference to them(ie, the end of the while loop).