ObjectOutputStream oos = new ObjectOutputStream(...);
...
write lots of objects to the ObjectOutputStream.
...
get OutOfMemory exception :-(.
ObjectOutputStream keeps a record of every object it has seen, and thus prevents the object from being garbage-collected, even when you ARE done with it.