ObjectOutputStream seems to be holding a reference to all the objects in my large graph, even after I close the stream. This keeps my objects from being garbage collected. Is this a bug?
Tim Rohaly ObjectOutputStream holds a reference to all the objects in the graph so it can handle circular references by noticing when an object has already been serialized. The only way to clear these references is by invoking reset() on the stream. The close() method does not do this, so unless you reset the stream explicitly, those references will be held until the ObjectOutputStream instance is itself garbage collected. This may take some time.