title: Where is the content of a Java piped stream 'stored'?
body: <p>I am running my application under a profiler. The 'class' that has the most memory consumption is the <code>char[]</code> which is about 10 kB in my application.</p>
  
  <p>I then created an <code>InputStream</code> (<code>PipedInputStream</code> to be exact) which holds a byte array data of 300 MB. </p>
  
  <p>Then I took a look at my profiler, and I don't see any significant change ( don't see anywhere that something eats up 300 MB). </p>
  
  <p>The question is, if that 300 MB of byte array is not in memory, where is Java keeping it?</p>
  
  <p><strong>[Update]</strong>
  Additional info on how I got the 300 MB to my <code>PipedInputStream</code>:</p>
  
  <p>I am developing a web app that has a file upload mechanism.
  And in one of the processes in my file upload, I create an input stream (<code>PipedInputStream</code>). Basically, </p>
  
  <ol>
  <li>I read the multipartfile's input stream (a few KB of byte[] at a time), </li>
  <li>Created a <code>PipedOutputStream</code></li>
  <li>Created a <code>PipedInputStream</code> (passing the recently created output stream to the constructor)</li>
  <li>Wrote the multipart's input stream to my <code>PipedOutputStream</code> (running on a separated thread; which flushes and closes that output stream before exiting the thread). <em>At this point, I now have a copy of the multipart's bytes in my own input stream</em></li>
  <li>Then (accidentally) stored that input stream in my http session (discussion/debate on whether that is a good idea would be on a different question)</li>
  </ol>
  
  <p>So the question then again is, where is Java keeping my <code>InputStream</code>'s content (I don't see it anywhere in my profiler)?</p>
  
  <p><strong>[Update#2]</strong></p>
  
  <p>I have a <code>FileOutputStream</code> which reads from the <code>PipedInputStream</code> and writes to a file.</p>