From: Roedy Green on
On Fri, 5 Feb 2010 22:56:40 -0800 (PST), Krist <krislioe(a)gmail.com>
wrote, quoted or indirectly quoted someone who said :

>When will the memory taken by the byteArrayInputStream will be
>released ?
>Will it be garbage collected ?

You would have to check the ByteArrayInputStream constructor source to
see if it makes a private copy of the byte array.

Presuming it does, the array would be GCed when there are no more
references to the BAOS.

Presuming it does not, the array would be GCed where there are no more
references to the BAOS, and no more reference to the original byte
array.
--
Roedy Green Canadian Mind Products
http://mindprod.com

Every compilable program in a sense works. The problem is with your unrealistic expections on what it will do.